11.03.2011, 23:07
Thats the problem!
The npc files need to be in npcmodes/
And npc functions can be used in gamemodes or filterscripts
Just create there a new pwn file and put all npc stuff in there
Looks like you got three npcs, so we need three files
Like that
To your command
1. AddStaticVehicle can only be used in OnGameModeInit, use CreateVehicle or put it in OnGameModeInit
2. You check if the player who typed the cmd is a npc which is obviously not the case
In the end I can only advice you to read the npc tutorial again but a bit more clearly ^^"
The npc files need to be in npcmodes/
And npc functions can be used in gamemodes or filterscripts
Just create there a new pwn file and put all npc stuff in there
Looks like you got three npcs, so we need three files
Like that
pawn Код:
// npcmodes/firemen1.pwn
#include <a_npc>
public OnNPCEnterVehicle(vehicleid, seatid)
StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER, "firemen1makefirestation");
public OnNPCExitVehicle(vehicleid, seatid) StopRecordingPlayback();
// npcmodes/firemen2.pwn
#include <a_npc>
public OnNPCEnterVehicle(vehicleid, seatid)
StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER, "firemen2makefirestation");
public OnNPCExitVehicle(vehicleid, seatid) StopRecordingPlayback();
// npcmodes/firemen3.pwn
#include <a_npc>
public OnNPCEnterVehicle(vehicleid, seatid)
StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER, "firemen3makefirestation");
public OnNPCExitVehicle(vehicleid, seatid) StopRecordingPlayback();
1. AddStaticVehicle can only be used in OnGameModeInit, use CreateVehicle or put it in OnGameModeInit
2. You check if the player who typed the cmd is a npc which is obviously not the case
pawn Код:
//OnGameModeInit
//arrays start with 0
Firemencar[0] = AddStaticVehicle(407,-2022.4456,93.0133,28.3217,272.4218,3,1);
Firemencar[1] = AddStaticVehicle(407,-2022.2397,83.8559,28.2866,270.2873,3,1);
Firemencar[2] = AddStaticVehicle(407,-2022.3734,75.7672,28.3362,272.2477,3,1);
pawn Код:
//OnPlayerCommandText
if(strcmp(cmdtext,"/backup1",true) == 0)
{
ConnectNPC("Fireman1","firemen1"); //we need to put there the the NPC scriptname
ConnectNPC("Fireman2","firemen2"); //which I named above fireman1-3.pwn
ConnectNPC("Fireman3","firemen3"); //just without the extention
SendClientMessageToAll(COLOR_PINK,"[BACKUP] Backup is coming for the flames at the train station !");
return 1;
}
pawn Код:
//OnPlayerSpawn
if(IsPlayerNPC(playerid))
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname));
if(!strcmp(npcname, "Fireman1", true)) {
PutPlayerInVehicle(playerid, Firemencar[0], 0);
} else if(!strcmp(npcname, "Fireman2",true)) {
PutPlayerInVehicle(playerid, Firemencar[1],0);
} else if(!strcmp(npcname,"Fireman3",true)) {
PutPlayerInVehicle(playerid, Firemencar[2],0);
}
return 1;
}



