NPC help ! it must be work !
#9

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
btw: those script above are all in one !
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
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();
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

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;
    }
In the end I can only advice you to read the npc tutorial again but a bit more clearly ^^"
Reply


Messages In This Thread
NPC help ! it must be work ! - by Michael@Belgium - 11.03.2011, 19:57
Re: NPC help ! it must be work ! - by Kwarde - 11.03.2011, 20:00
Re: NPC help ! it must be work ! - by Michael@Belgium - 11.03.2011, 20:02
Re: NPC help ! it must be work ! - by Kwarde - 11.03.2011, 20:03
Re: NPC help ! it must be work ! - by Michael@Belgium - 11.03.2011, 20:07
Re: NPC help ! it must be work ! - by Kwarde - 11.03.2011, 20:08
Re: NPC help ! it must be work ! - by Michael@Belgium - 11.03.2011, 20:10
Re: NPC help ! it must be work ! - by Kwarde - 11.03.2011, 20:18
AW: Re: NPC help ! it must be work ! - by Nero_3D - 11.03.2011, 23:07
Re: AW: Re: NPC help ! it must be work ! - by Michael@Belgium - 12.03.2011, 08:34

Forum Jump:


Users browsing this thread: 1 Guest(s)