Message return bug - 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: Message return bug (
/showthread.php?tid=476032)
Message return bug -
whando - 16.11.2013
Doesn't return ''This player is not admin jailed" when someone isn't , what did I do wrong? In the jail command I did set the player pAjailed to 1, now I can even unjail someone when they are not ajailed, and also when they are..
Код:
if(strcmp(cmd, "/unjail", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
return 1;
}
if(PlayerInfo[playerid][pAjailed] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "This player is not admin jailed.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unjail [playerid/PartOfName]");
return 1;
}
new giveplayerid = ReturnUser(tmp);
if(giveplayerid == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_WHITE, " Player not found !");
return 1;
}
KillTimer(unajailtimer); // should be unajailtimer[giveplayerid] and on top - new unajailtimer[MAX_PLAYERS];
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
SetPlayerInterior(giveplayerid, 0);
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[giveplayerid][pVirtualWorld] = 0;
SetPlayerPos(giveplayerid, 533.8759,-1675.7471,18.7500,353.4335);
SetPlayerFacingAngle(giveplayerid, 90);
format(string,sizeof(string),"Admin %s has released you from admin jail.", RemoveUnderScore(playerid));
SendClientMessage(giveplayerid, COLOR_BLUE, string);
PlayerInfo[giveplayerid][pPrisons] -= 1;
return 1;
}
Re: Message return bug -
NeMoK - 16.11.2013
pawn Код:
if(strcmp(cmd, "/unjail", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unjail [playerid/PartOfName]");
new giveplayerid = ReturnUser(tmp);
if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_WHITE, " Player not found !");
if(PlayerInfo[giveplayerid][pAjailed] == 0) return SendClientMessage(playerid, COLOR_GREY, "This player is not admin jailed.");
KillTimer(unajailtimer); // should be unajailtimer[giveplayerid] and on top - new unajailtimer[MAX_PLAYERS];
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
SetPlayerInterior(giveplayerid, 0);
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[giveplayerid][pVirtualWorld] = 0;
SetPlayerPos(giveplayerid, 533.8759,-1675.7471,18.7500,353.4335);
SetPlayerFacingAngle(giveplayerid, 90);
format(string,sizeof(string),"Admin %s has released you from admin jail.", RemoveUnderScore(playerid));
SendClientMessage(giveplayerid, COLOR_BLUE, string);
PlayerInfo[giveplayerid][pPrisons] -= 1;
return 1;
}
Re: Message return bug -
whando - 16.11.2013
Thanks! But I also just noticed I forgot to set pAjailed to 0
.