PlayerPos help
#9

To check what key has player pressed use OnPlayerKeyStateChange

To check if there is a suspect next to him
you can use this code(in my opinion the fastest way of doing this):
pawn Код:
//global variable
new Suspects[MAX_PLAYERS+1];
//_________________________________
// under OnPlayerKeyStateChange when pressed key
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
for(new i=0;Suspects[i]!=-1;i++)
if(IsPlayerInRangeOfPoint(Suspects[i],5,x,y,z))//chage 5 if too big or small range
{
    //your code
}
//_______________________________________
// once player becomes wanted/suspect
new i;
for(i=0;Suspects[i]!=-1;i++){}
Suspects[i]=playerid;//suspectid
Suspects[i+1]=-1;
//----------------------------------
//once player is no loger wanted/suspect - of is jailed, prisoned, DON'T FORGET DISCONNECTED, or something else
new i;
for(i=0;Suspects[i]!=playerid;i++){}//playerid=suspectid
while(Suspects[i]!=-1)Suspects[i]=Suspects[i+1];
Reply


Messages In This Thread
PlayerPos help - by jimis - 29.07.2012, 13:15
Re: PlayerPos help - by Cjgogo - 29.07.2012, 13:17
Re: PlayerPos help - by jimis - 29.07.2012, 13:25
Re: PlayerPos help - by Devilxz97 - 29.07.2012, 13:29
Re: PlayerPos help - by Sinner - 29.07.2012, 13:39
Re: PlayerPos help - by jimis - 29.07.2012, 13:40
Re: PlayerPos help - by Sinner - 29.07.2012, 13:41
Re: PlayerPos help - by Devilxz97 - 29.07.2012, 13:45
Re: PlayerPos help - by Roko_foko - 29.07.2012, 13:56
Re: PlayerPos help - by Sinner - 29.07.2012, 14:07

Forum Jump:


Users browsing this thread: 3 Guest(s)