Need help with NPC
#5

I noticed that you were "returning 1" when it wasn't necessary. I would replace your "OnPlayerSpawn" with this:

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
        if(!strcmp(npcname, "rhino", true)) //Checking if the NPC's name is MyFirstNPC
        {
            PutPlayerInVehicle(playerid, rhinodriver, 0); //Putting the NPC into the vehicle we created for it.
        }
    }
    return 1;
}
Just make sure that in your 'server.cfg' file, you have identified that you have NPC's in your server. Simply change this line:

Код:
maxnpc 0
Obviously replacing 0 with however many NPC's you have.
Reply


Messages In This Thread
Need help with NPC - by corne - 27.10.2010, 19:07
Re: Need help with NPC - by Backwardsman97 - 27.10.2010, 19:19
Re: Need help with NPC - by boelie - 27.10.2010, 19:35
Re: Need help with NPC - by Backwardsman97 - 28.10.2010, 03:03
Re: Need help with NPC - by Scenario - 28.10.2010, 03:09
Re: Need help with NPC - by Blade_Cervetti - 28.10.2010, 03:18
Re: Need help with NPC - by Scenario - 28.10.2010, 03:20
Re: Need help with NPC - by Blade_Cervetti - 28.10.2010, 03:26

Forum Jump:


Users browsing this thread: 1 Guest(s)