Start working on persistent NPCs

This commit is contained in:
Vortrex
2021-12-03 10:22:35 -06:00
parent d8276a8160
commit 3c11eb5e8e

View File

@@ -18,3 +18,30 @@ function getNPCData(ped) {
}
// ===========================================================================
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);
}
// ===========================================================================