SA-MP Forums Archive
Problem with playerid's ... - 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: Problem with playerid's ... (/showthread.php?tid=127507)



Problem with playerid's ... - Universal - 13.02.2010

Hey, everyone, i have one problem, when i test with my friend my script theres nor warnings when compiled, but when we play i use command for ex. /jail ID TIME REASON it jails wrong player, not me, but my friend. I typed IDS correctly (i know how tu use commands lol)


Code:

Код:

dcmd_jail(playerid,params[])
 {
 if(pInfo[playerid][AdminLevel] > 0)
 {
 #pragma unused params
 new ID, OBTime, Reason[30];
 if(sscanf(params,"iis",ID,OBTime,Reason))return SendClientMessage(playerid,GREY," Usage: /jail ID Minutes Reason");
 new AdminName[MAX_PLAYER_NAME]; GetPlayerName(playerid,AdminName,MAX_PLAYER_NAME);
 new VictimName[MAX_PLAYER_NAME]; GetPlayerName(playerid,VictimName,MAX_PLAYER_NAME);
 new Message[100]; format(Message,100,"Admin command: %s jailed [ID:%d]%s, for: %dmins. (Reason: %s )",AdminName,ID,VictimName,OBTime,Reason);
 SendClientMessageToAll(RED,Message);
 PlayersAtJail++;
 SetPlayerInterior(ID, 10);
 SetPlayerPos(ID , 215.1641, 110.5463, 999.0156);
 new JTime = OBTime*60000;
 SetTimerEx("JailRelease" , JTime, false,"i",playerid);
 pInfo[ID][Jail]=JTime;
 JailPosCheck = SetTimerEx("JailedPlayerPosCheck",1000,true,"i",playerid);
 }
 return 1;
 }
Or if i want to unjail my self, it unjails other player... fucking weard things going on :O



Re: Problem with playerid's ... - Universal - 13.02.2010

well


Re: Problem with playerid's ... - mansonh - 13.02.2010

Quote:

b) Do not bump
Some people apparently think they are important enough to bump their own topic after 10 minutes.
You can bump topics when the last reply is at least 12 hours old.

I can't see why it jails the wrong person.
However there were a number of places where you were using playerid where you should have been using ID

pawn Код:
dcmd_jail(playerid,params[])
 {
 if(pInfo[playerid][AdminLevel] > 0)
 {
 #pragma unused params
 new ID, OBTime, Reason[30];
 if(sscanf(params,"iis",ID,OBTime,Reason))return SendClientMessage(playerid,GREY," Usage: /jail ID Minutes Reason");
 new AdminName[MAX_PLAYER_NAME]; GetPlayerName(playerid,AdminName,MAX_PLAYER_NAME);
 new VictimName[MAX_PLAYER_NAME]; GetPlayerName(ID,VictimName,MAX_PLAYER_NAME);
 new Message[128]; format(Message,128,"Admin command: %s jailed [ID:%d]%s, for: %dmins. (Reason: %s )",AdminName,ID,VictimName,OBTime,Reason);
 SendClientMessageToAll(RED,Message);
 PlayersAtJail++;
 SetPlayerInterior(ID, 10);
 SetPlayerPos(ID , 215.1641, 110.5463, 999.0156);
 new JTime = OBTime*60000;
 SetTimerEx("JailRelease" , JTime, false,"i",ID);
 pInfo[ID][Jail]=JTime;
 JailPosCheck = SetTimerEx("JailedPlayerPosCheck",1000,true,"i",ID);
 }
 return 1;
 }



Re: Problem with playerid's ... - Universal - 14.02.2010

Quote:
Originally Posted by mansonh
Quote:

b) Do not bump
Some people apparently think they are important enough to bump their own topic after 10 minutes.
You can bump topics when the last reply is at least 12 hours old.

I can't see why it jails the wrong person.
However there were a number of places where you were using playerid where you should have been using ID

pawn Код:
dcmd_jail(playerid,params[])
 {
 if(pInfo[playerid][AdminLevel] > 0)
 {
 #pragma unused params
 new ID, OBTime, Reason[30];
 if(sscanf(params,"iis",ID,OBTime,Reason))return SendClientMessage(playerid,GREY," Usage: /jail ID Minutes Reason");
 new AdminName[MAX_PLAYER_NAME]; GetPlayerName(playerid,AdminName,MAX_PLAYER_NAME);
 new VictimName[MAX_PLAYER_NAME]; GetPlayerName(ID,VictimName,MAX_PLAYER_NAME);
 new Message[128]; format(Message,128,"Admin command: %s jailed [ID:%d]%s, for: %dmins. (Reason: %s )",AdminName,ID,VictimName,OBTime,Reason);
 SendClientMessageToAll(RED,Message);
 PlayersAtJail++;
 SetPlayerInterior(ID, 10);
 SetPlayerPos(ID , 215.1641, 110.5463, 999.0156);
 new JTime = OBTime*60000;
 SetTimerEx("JailRelease" , JTime, false,"i",ID);
 pInfo[ID][Jail]=JTime;
 JailPosCheck = SetTimerEx("JailedPlayerPosCheck",1000,true,"i",ID);
 }
 return 1;
 }
Thats only on the formatting, i know that. But thanks, does any one know why this command freaking pisses me off ? Somethings wrong with that, i know it.


Re: Problem with playerid's ... - mansonh - 14.02.2010

Wasn't only the formatting if you check closely, you were also trying to release the admin from jail too, not the victim.

Does it now show the right person is going to jail and send the wrong person.

You can always put in some printf check statements to see whats going on.