SA-MP Forums Archive
Static NPC - Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Static NPC - Help (/showthread.php?tid=580773)



Static NPC - Help - Lumabd - 08.07.2015

It`s possible to put guns to this NPC`s? If yes, how?


Re: Static NPC - Help - Banana_Ghost - 08.07.2015

NPCs take a player slot, as well as assigned a player id, so use GivePlayerWeapon, like for example:
PHP код:
public OnPlayerSpawn(playerid){

    new 
pname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpnamesizeof(pname)); // Getting the player's name.
    
    
if(!strcmp(pname"botnamehere")){ // Compare the player's name with the name you specify
    
        
GivePlayerWeapon(playerid315000); // Give the bot a M4 with 5000 ammo.
    
}
    
    return 
1;