SA-MP Forums Archive
Can this be converted? - 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: Can this be converted? (/showthread.php?tid=441287)



Can this be converted? - Tomix - 02.06.2013

Hello can this code be converted to a normal cmd?:
Код:
CMD:unban(playerid, params[])
{
	if(pInfo[playerid][pLogged] == 1)
	{
		if(pInfo[playerid][pAdminLevel] >= 2)
		{
		    new Query[200];
			if (!strlen(params)) return SendClientMessage(playerid,-1,""chat" /unban [name]");
			format(Query, sizeof(Query), "SELECT `Name` FROM `banlog` WHERE Name = '%s' AND pAccountLock = 1 LIMIT 1", escstring(params));
			mysql_query(Query);
			mysql_store_result();
			if(!mysql_num_rows())
			{
		        new string[200];
		    	format(string, sizeof(string), ""chat" Nobody under the name of %s is banned!", params);
				mysql_free_result();
				return SendClientMessage(playerid,-1,string);
			}
			else if(mysql_num_rows() != 0)
			{
			    format(Query, sizeof(Query), "UPDATE `banlog` SET `pAccountLock` = 0 WHERE Name = '%s'", escstring(params));
				mysql_query(Query);
				mysql_store_result();
		    	new string[200];
				format(string, sizeof(string), ""chat" %s has been unbanned!", params);
				SendClientMessage(playerid, 0x66FF33, string);
			}
		}
	}
	return 1;
}

/*
CMD:unban(playerid, params[])
{
    if(pInfo[playerid][pAdminLevel] >= 2)
    {
        if(IsPlayerConnected(playerid))
        {
	        new name[24], query[128], string[128];
	        if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, -1, ""chat" /unban [player name] CASE SENSITIVE!");

	        format(query, sizeof(query), "SELECT * FROM users WHERE Username = '%s'", name);
	        mysql_query(query);
	        mysql_store_result();

	        new row = mysql_num_rows();
	        if(row == 1)
	        {
         		format(string, sizeof(string), "UPDATE banlog SET pBannedReason ='none',pBannedBy='none',pIPBanned='unbanned',pAccountLock='0',pIPBanned='0' WHERE Username='%s'", name);
         		mysql_query(string);

				format(string, sizeof(string), ""chat" You have unbanned account %s", name);
				SendClientMessage(playerid, -1, string);
	        }
	        else SendClientMessage(playerid, -1, ""chat" Username is invalid!");
	        mysql_free_result();
		}
    }
   	else {
		SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" You do not have the right admin permissions for this command!");
	}
    return 1;
}
*/
and if yes please someone do so


Re: Can this be converted? - Kittylol - 02.06.2013

You want convert it without these CMD and something like this ?


Re: Can this be converted? - Akira297 - 02.06.2013

I best believe he wants the command to be re-written into possible Y_INI or Dini.. I'm not exactly sure which one he's wanting.