NPC help
#4

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Just easy tricks:

PHP код:
//Under OnPlayerConnect always@TOP!
if(IsPlayerNPC(playerid)) return 1;
//Under OnPlayerRequestClass
if(IsPlayerNPC(playerid))
{
    
SetSpawnInfo(playerid,0,299,0,0,3,0,0,0,0,0,0,0);
    
SpawnPlayer(playerid);
    return 
1;
}
//Under OnPlayerSpawn
if(IsPlayerNPC(playerid))
{
    new 
n[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,n,MAX_PLAYER_NAME);
    if(!
strcmp(n,"Peter"))
    {
        
//For example if Peter spawns:
        
SetPlayerSkin(playerid69); //Like this number :3
    
}
    return 
1;

If you do this statements always at the top of these callbacks..nothing can happen with them and they will spawn directly
If you wanna have Zombie NPCs you have to use a Plugin..like FCNPC
Just look at some tutorials how you create them
Thanks so much!! I'm using a zombie NPC filterscript

The only problem is, I use the command /zombie to add a zombie and the number goes up each time. Example, /zombie would create a zombie called "Zombie_1" then using the command again would create "Zombie_2" etc... so how would I get the zombies name?
This is the code in the filterscript for getting the zombie name, would I add that into the OnPlayerSpawn in my gamemode?
PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if(
strcmp(cmdtext"/zombie"true) == 0) {
        if(!
IsPlayerAdmin(playerid)) return false;
        
Caller playerid;
        new 
newname[64];
        
format(newname,sizeof(newname),"%s_%d",ZOMBIE_NAME,LastAdded);
        
ConnectNPC(newname,"zombie");
        
LastAdded++;
        return 
1;
    }
    return 
0;

Thanks again!
Reply


Messages In This Thread
NPC help - by Josh_Main - 19.09.2016, 15:31
Re: NPC help - by Kaliber - 19.09.2016, 15:43
Re: NPC help - by jlalt - 19.09.2016, 15:44
Re: NPC help - by Josh_Main - 19.09.2016, 15:49
Re: NPC help - by Kaliber - 19.09.2016, 16:08
Re: NPC help - by Josh_Main - 19.09.2016, 16:21
Re: NPC help - by Kaliber - 19.09.2016, 16:33
Re: NPC help - by Josh_Main - 19.09.2016, 16:37
Re: NPC help - by Kaliber - 19.09.2016, 16:38
Re: NPC help - by Josh_Main - 19.09.2016, 16:44

Forum Jump:


Users browsing this thread: 3 Guest(s)