20.10.2009, 17:50
Код:
new ConnectNPC; public OnFilterScriptInit() { print("scriptfiles"); ConnectNPC("Taxi","TAXI"); return 1; } new MyFirstNPCVehicle; //Global variable! publicOnFilterScriptInit() //first here you havent a place public[place]OnFil........, second, you cant have 2Ч public OnFilterScriptInit() { print("BlaBla"); ConnectNPC("Taxi","TAXI"); MyFirstNPCVehicle = CreateVehicle(420,1536.6427,-841.7883,64.4755,266.3878,6,1, 5000); return 1; } 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, "TAXI", true)) //Checking if the NPC's name is MyFirstNPC { PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it. } return 1; } //Other stuff for normal players goes here! return 1; }
pawn Код:
new ConnectNPC; //you dont need this, because its already defined, so delete this...
public OnFilterScriptInit()
{
ConnectNPC("Taxi","TAXI");
MyFirstNPCVehicle = CreateVehicle(420,1536.6427,-841.7883,64.4755,266.3878,6,1, 5000);
return 1;
}
new MyFirstNPCVehicle; //Global variable!
}
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, "TAXI", true)) //Checking if the NPC's name is MyFirstNPC
{
PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
}
return 1;
}
//Other stuff for normal players goes here!
return 1;