Start working on persistent NPCs
This commit is contained in:
@@ -17,4 +17,31 @@ function getNPCData(ped) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function createNPCCommand(client, command, params) {
|
||||||
|
if(areParamsEmpty(params)) {
|
||||||
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let skinId = getSkinModelIndexFromParams(params);
|
||||||
|
|
||||||
|
if(!skinId) {
|
||||||
|
messagePlayerError(client, `Invalid skin`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let position = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), 3);
|
||||||
|
|
||||||
|
let tempNPCData = new NPCData(false);
|
||||||
|
tempNPCData.position = position;
|
||||||
|
tempNPCData.heading = getPlayerHeading(client);
|
||||||
|
tempNPCData.skin = skinId;
|
||||||
|
|
||||||
|
let npcIndex = getServerData().npcs.push(tempNPCData);
|
||||||
|
|
||||||
|
spawnNPC(npcIndex-1);
|
||||||
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
Reference in New Issue
Block a user