17.08.2011, 15:27
hi, i would like to know what is the best way to check npc position (like PlayerToPoint()).It should be onPlayerUpdate or maybe timer?Something else?
public OnPlayerEnterCheckpoint(playerid)
{
DisablePlayerCheckpoint(playerid);
if(IsPlayerNPC(playerid))
{
SendClientMessageToAll(MELSVA,"NPC ENTERED CP");
if(IsPlayerInMission[playerid]==6)
{
IsNPCWinner=true;
for(new p=0; p<MAX_PLAYERS; p++)
{
new names[26];
GetPlayerName(p,names,sizeof(names));
if(!strcmp(names,"NPC_Racer"))
{
SendClientMessageToAll(MELSVA,"NPC WINS RACES");
IsNPCInRace=false;
IsPlayerInMission[p]=0;
Kick(p);
ConnectNPC("NPC_Racer","steady");
}
}
}
return 1;
}
return 1;
}
stock RaceStart(playerid)
{
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~ 3 ~g~-",1000,3);
TogglePlayerControllable(playerid,false);
VehiclePlayerPos(playerid,-2274.1875,-120.1094,35.1253,272.8494);
if(IsPlayerInRace[playerid]== 1)
{
for(new p=0; p<MAX_PLAYERS; p++)
{
new names[26];
GetPlayerName(p,names,sizeof(names));
if(!strcmp(names,"NPC_Racer"))
{
Kick(p);
}
}
ConnectNPC("NPC_Racer","race1");
for(new p=0; p<MAX_PLAYERS; p++)
{
new names[26];
GetPlayerName(p,names,sizeof(names));
if(!strcmp(names,"NPC_Racer"))
{
IsPlayerInMission[p]=6;
SetPlayerCheckpoint(p,-1735.4344,-580.2195,16.0630,15);
}
}
}
}