SA-MP Forums Archive
lspd track - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: lspd track (/showthread.php?tid=80041)



lspd track - Wellington_uk - 01.06.2009

Can anyone point me in the right direction, I,ve edited the track command in West coast RP to be used by lspd, yet when i try to use the command it says im not a member of lspd.........any help would be appreciated:


//-------------------_-----LSPD tracking system------------------------------//
if(strcmp(cmd, "/track", true) == 0)
{
if(PlayerInfo[playerid][pMember] != 1 ||PlayerInfo[playerid][pLeader] != 1)
{
SendClientMessage(playerid, COLOR_GREY, " You are not a member of the lspd !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /track [playerid/PartOfName]");
return 1;
}
lspdtrack = ReturnUser(tmp);
if(IsPlayerConnected(lspdtrack))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(lspdtrack, giveplayer, sizeof(giveplayer));
new Float:X,Float:Y,Float:Z;
GetPlayerPos(lspdtrack, X,Y,Z);
SetPlayerMarkerForPlayer(playerid,lspdtrack, 0xFF0000FF );
SendClientMessage(playerid, COLOR_LIGHTBLUE, " Suspect is now visible, get him !");
}
}
}
if (strcmp(cmdtext, "/canceltrack", true)==0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMember] == 1 ||PlayerInfo[playerid][pLeader] != 1)
{
SetPlayerMarkerForPlayer(playerid, lspdtrack, 0xFFFFFF00 );
DisablePlayerCheckpoint(playerid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, " Suspect is now unvisible!");
return 1;


Re: lspd track - silvan - 01.06.2009

make sure about this if statement:

This means that if " you " ( pMember ) is NOT! 1 OR You ( Leader ) is NOT! 1 Then do this...
Код:
   if(PlayerInfo[playerid][pMember] != 1 ||PlayerInfo[playerid][pLeader] != 1)
i think your problem is with the If statement

try to replace the " || " to " && " so it will say that if pmember is not 1 AND pleader is not 1 then...


|| means OR
&& means AND

Logic Gates will come useful in these things


Re: lspd track - Wellington_uk - 01.06.2009

many thanks for your reply, but do you mean replace = with &&? i see no characters like you indicated......


Re: lspd track - silvan - 01.06.2009

no... replace " || " with " && " its just in the middle of the if statement....

This is how i'm saying....
if(PlayerInfo[playerid][pMember] != 1 && PlayerInfo[playerid][pLeader] != 1)

and this is yours:
if(PlayerInfo[playerid][pMember] != 1 ||PlayerInfo[playerid][pLeader] != 1)


Re: lspd track - Wellington_uk - 01.06.2009

ah i must be blind, i see it now many thanks again



Re: lspd track - Wellington_uk - 01.06.2009

works like a charm, If I could I would buy you a few beers. Many thanks man. I owe you one