17.11.2014, 17:40
Hi, I'm trying to work out how to check if a player is banned using y_ini.. as I'm writing a unban command and even if the player is unbanned it still says you have unbanned this player.. I'm trying to write an if statement to check if the players file has the variable pBanned == 1.
Here is my code:
And now I'll add where I want the if statement to be:
I hope you understand me, and help. Thanks in advance.
Here is my code:
Код:
CMD:unban(playerid, params[]) { if(PlayerInfo[playerid][pAdminLevel] >= 2) { new path[124]; if(isnull(params)) return SendClientMessage(playerid, -1, "Syntax - /unban <Player Name>"); format(path,sizeof(path),"Accounts/%s.ini",params); if(fexist(path)) { new INI:file = INI_Open(path); INI_SetTag(file,"data"); INI_WriteInt(file,"Banned",0); INI_Close(file); new unbanstring[124]; format(unbanstring, sizeof(unbanstring), "You have unbanned the account: (%s)", params); SendClientMessage(playerid, -1, unbanstring); }else SendClientMessage(playerid,-1,"Account not found, make sure you type the exact name."); }else SendClientMessage(playerid, -1, "Error: You must be admin level 2 or higher."); return 1; }
Код:
CMD:unban(playerid, params[]) { if(PlayerInfo[playerid][pAdminLevel] >= 2) { new path[124]; if(isnull(params)) return SendClientMessage(playerid, -1, "Syntax - /unban <Player Name>"); format(path,sizeof(path),"Accounts/%s.ini",params); if(fexist(path)) { if(IS THE PLAYER ISN'T ALREADY BANNED) { new INI:file = INI_Open(path); INI_SetTag(file,"data"); INI_WriteInt(file,"Banned",0); INI_Close(file); new unbanstring[124]; format(unbanstring, sizeof(unbanstring), "You have unbanned the account: (%s)", params); SendClientMessage(playerid, -1, unbanstring); }else SendClientMessage(playerid,-1,"This account is not banned."); }else SendClientMessage(playerid,-1,"Account not found, make sure you type the exact name."); }else SendClientMessage(playerid, -1, "Error: You must be admin level 2 or higher."); return 1; }