Restriction wont work -
StR_MaRy - 13.02.2017
hey guys i have a dialog a working one..
![Cheesy](images/smilies/biggrin.png)
i have a meniu like Ban-Kick-Warn-Unwarn so i did everything like i said is working but i have a problem when i select Unwarn and the player have 0 Warns should give to me a message like "This player has no warns" i did this but why isn't working :-s ?
full code from first dialog after selecting "Unwarn"
Код HTML:
if(listitem == 3)
{
if(PlayerInfo[playerid][pAdmin] > 5)
{
if(PlayerInfo[playerid][pLeaderWarn] >= 1)
{
format(strings, sizeof(strings), "{FFFFFF}Type the reason why you want to unwarn this guy %s.", PlayerInfo[playerid][pSelected]);
ShowPlayerDialog(playerid, DIALOG_LLIST5, DIALOG_STYLE_INPUT, "Next", strings, "Done", "Cancel");
}
else return SendClientMessage(playerid,COLOR_ERROR,"That leader has no warns!");
}
else return SendClientMessage(playerid,COLOR_ERROR,"You need to be owner to use this menu!");
}
EDIT: if the selected player has 0 warns and i try to unwarn him it goes like -1, -2, etc...
Re: Restriction wont work -
MiiSha - 13.02.2017
Try this :
Код:
if(listitem == 3)
{
if(PlayerInfo[playerid][pAdmin] > 5)
{
if(PlayerInfo[playerid][pLeaderWarn] == 0) return SendClientMessage(playerid,COLOR_ERROR,"That leader has no warns!");
else
{
format(strings, sizeof(strings), "{FFFFFF}Type the reason why you want to unwarn this guy %s.", PlayerInfo[playerid][pSelected]);
ShowPlayerDialog(playerid, DIALOG_LLIST5, DIALOG_STYLE_INPUT, "Next", strings, "Done", "Cancel");
}
}
else return SendClientMessage(playerid,COLOR_ERROR,"You need to be owner to use this menu!");
}
It hasn't really changed anything but I guess that way the dialog where you input the reason and unwarn the person "DIALOG_LLIST5" won't even be called.
Re: Restriction wont work -
StR_MaRy - 13.02.2017
is working for online players only if you are offline isn't working i still can unwarn you until you get -10
Re: Restriction wont work -
Scriptery - 19.08.2017
For action on offline players, don`t use variables, check player, if is online, use variables, but player is not connected, you need update player warns to data base.
example: "UPDATE `users` SET Warns = Warns - 1 WHERE PlayerName = '%e' AND Warns > 0 LIMIT 1"
And after execute query, Will be called function with mysql_tquery, for check rows affected, if 0 rows affected, return message for admin: "Player don`t exist or not have warns".