NPC Respawning
#1

I want to respawn a npc so a player can get in its vehicle and fly to SF..

code.

Код:
public OnPlayerSpawn(playerid)
{
	if(IsPlayerNPC(playerid))
	{
 		new npcname[MAX_PLAYER_NAME];
	    GetPlayerName(playerid, npcname, sizeof(npcname));
	    if(!strcmp(npcname, "FlightToSF", true))
	    {
	      	Flight1 = CreateVehicle(577,0,0,0,0,7,7,0);
	      	PutPlayerInVehicle(playerid, Flight1, 0);
	    }
	    return 1;
	}
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid)
	{
	    case 3:
	    {
	        if(!response) return 1;
	        if(listitem == 0)
	        {
        		new i;
				for(new id; id<MAX_PLAYERS; id++)
				{
					new name[21];
					GetPlayerName(i,name,sizeof name);
					if(!strcmp(name,"FlightToSF",true))
					{
						i = id;
					}
					DestroyVehicle(Flight1);
					SpawnPlayer(i);
					PutPlayerInVehicle(playerid, Flight1,1);
					SendNotification(playerid,"You can press ENTER to leave~n~the plane.");
					return 1;
				}
	            
	        }
	    }
	}
	return 1;
}
but its not working.
Reply


Messages In This Thread
NPC Respawning - by CJ101 - 23.09.2013, 21:05
Re: NPC Respawning - by Cell_ - 25.09.2013, 12:38
Re: NPC Respawning - by CJ101 - 25.09.2013, 17:45

Forum Jump:


Users browsing this thread: 1 Guest(s)