Un ban command
#1

I use this command when i used to use dudb but now i'm using y_ini

Код:
dcmd_adunban(playerid, params[])
{
   		new string[128];
	   	if(!strlen(params))
 		{
		   	format(string, sizeof(string), "[ERROR] {FFFFFF}USAGE:/adunban (Player Name)");
	  	   	SendClientMessage(playerid,COLOR_RED,string);
       		        return 1;
   		}
		if(!udb_Exists(params))
		{
	   		format(string, sizeof(string), "[ERROR] {FFFFFF}The player file %s is not found.",params);
	                SendClientMessage(playerid,COLOR_RED,string);
	                return 1;
   		}
	        format(string, sizeof(string), "unbanip %s", dUser(params).("IP"));
	        SendRconCommand(string);
	   	format(string, sizeof(string), "reloadbans");
	   	SendRconCommand(string);
	   	new nameban = dUserINT(params).("Nameban");
	   	if(nameban == 0)
	   	{
	       	        format(string, sizeof(string), "[ERROR] {FFFFFF}The Player Name %s is not banned.", params);
   			SendClientMessage(playerid,COLOR_RED,string);
	       	        return 1;
	   	}
	   	dUserSetINT(params).("Nameban", 0);
	   	format(string, sizeof(string), "[ADMIN]%s has been unbanned by %s",params,PlayerName(playerid));
	   	printf("%s", string);
	   	SendClientMessage(playerid,COLOR_RED,string);
	   	return 1;
}
How can i convert it that it opens the file and make
Код:
PlayerInfo[ID][pBanned] =0;
?
Reply
#2

Considering the contents of this question, I'm going to assume you are using someone else's script. That being said, I'll give you an answer regarding this assumption.

1. Add 'pBanned' to the player information enum that you are using (probably near the top of the script).
2. Find the load/save/register section of the script and utilize your abilities to copy and paste to create a new saved variable under the name of your choice. I would recommend 'pBanned' for continuity purposes.
3. Utilize the variable in the code above instead of the rcon functions present.

If you need more specific help, just ask. At least give it a try though and let me know where you get stuck.
Reply
#3

Код:
CMD:adunban(playerid, params[])
{
   		new string[128];
	   	if(!strlen(params))
 		{
		   	format(string, sizeof(string), "[ERROR] {FFFFFF}USAGE:/adunban (Player Name)");
	  	   	SendClientMessage(playerid,COLOR_RED,string);
       		        return 1;
   		}
		if(!udb_Exists(params))
		{
	   		format(string, sizeof(string), "[ERROR] {FFFFFF}The player file %s is not found.",params);
	                SendClientMessage(playerid,COLOR_RED,string);
	                return 1;
   		}
	        format(string, sizeof(string), "unbanip %s", dUser(params).("IP"));
	        SendRconCommand(string);
	   	format(string, sizeof(string), "reloadbans");
	   	SendRconCommand(string);
	   	new nameban = dUserINT(params).("Nameban");
	   	if(nameban == 0)
	   	{
	       	        format(string, sizeof(string), "[ERROR] {FFFFFF}The Player Name %s is not banned.", params);
   			SendClientMessage(playerid,COLOR_RED,string);
	       	        return 1;
	   	}
	   	dUserSetINT(params).("Nameban", 0);
	   	format(string, sizeof(string), "[ADMIN]%s has been unbanned by %s",params,PlayerName(playerid));
	   	printf("%s", string);
	   	SendClientMessage(playerid,COLOR_RED,string);
	   	return 1;
}
i dont think it will work as i dont no much about converting saving systems but as far as i see it wont work due to this below

this here is the dub saving system if you wanted it as Y_INI you might wanna read up about dub and Y_INI

Checks user name banning
Код:
dUserSetINT(params).("Nameban", 0);
add this on enum pInfo just simply find it
Код:
PlayerInfo[ID][pBanned] =0;
Reply
#4

it can't be saved coz there must be a code that writes in saved files like this
dUserSetINT(params).("Nameban", 0);
Reply
#5

Anyone knows?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)