SA-MP Forums Archive
NPC should call function - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: NPC should call function (/showthread.php?tid=291303)



NPC should call function - Zcelo12 - 19.10.2011

Hey guys,
At the moment, im scripting at a special bot. My problem is that i have
to call a function in the gamemode. CallRemoteFunction doesn't work in NPC_Scripts and
SendCommand doesn't work for me, because i use zcmd.

Hope someone can help me...


Re: NPC should call function - aRoach - 19.10.2011

What command do you wanna call ?


AW: NPC should call function - Zcelo12 - 19.10.2011

This one:

Код:
CMD:starttour(playerid,params[])
{
	if(!IsPlayerNPC(playerid)) return 0;
    CheckTour(1);
    return 1;
}



Re: NPC should call function - aRoach - 19.10.2011

At OnGameModeInit:
pawn Код:
for( new i = 0; i < MAX_PLAYERS; i ++ ) cmd_starttour( 1 );
No more SendCommand:
cmd_[COMMAND](playerid, params);


AW: NPC should call function - Zcelo12 - 19.10.2011

Isn't this calling the cmd for every player?


Re: NPC should call function - aRoach - 19.10.2011

Yes it is, why ?


AW: NPC should call function - Zcelo12 - 19.10.2011

Only the bot should do this command.
And he should call it when the recording starts...


Re: NPC should call function - aRoach - 19.10.2011

Yes, but do you know...
pawn Код:
if(!IsPlayerNPC(playerid)) return 0;
Have you forgotted, is your code, dude )

But, it's better you do this at OnPlayerConnect, just like this:
pawn Код:
public OnPlayerConnect( playerid )
{
    cmd_starttour( playerid );
    return 1;
}



AW: NPC should call function - Zcelo12 - 19.10.2011

!IsPlayerNPC = If he isn't a NPC
And still only the bot should call the cmd when he start the recording