SA-MP Forums Archive
Command help - 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: Command help (/showthread.php?tid=616607)



Command help - XHunterZ - 07.09.2016

hello guys am just asking how to create a command like /aka am using MySQL data base so if someone know please tell me am still learning.


Re: Command help - kelvinis - 07.09.2016

What is /aka ?


Re: Command help - Luis- - 07.09.2016

Presuming also known as?


Re: Command help - XHunterZ - 07.09.2016

i mean when I use /aka playerid it shows me all his accounts


Re: Command help - thefirestate - 07.09.2016

I don't feel like writing the cmd, but here is how to do it: save the IP of the user who registered the account, then select from the database where the IP is equal to the one saved or if you are having a master account system for example just check all the characters assigned to this master account.


Re: Command help - Ultraz - 07.09.2016

Can you give us any command from your admin commands?
to let us know about how your system run


Re: Command help - XHunterZ - 08.09.2016

ok wait @ultraz and @thefirestate that's what am asking about how to check them with MySQL

Код:
 COMMAND:ban(playerid, params[])
{
	if(playerData[playerid][playerLoggedIn])
	{
		if(playerData[playerid][playerLevel] >= 3)
		{
			new otherID, playersIP[24], playerName[24], adminName[24], message[248], reason[300];

			if(sscanf(params, "us[300]", otherID, reason))
			{
				SendClientMessage(playerid, COLOR_WHITE, "{FF0770}[Admin] Usage: \"ban <playername/id> <reason>\"");
			}
			else
			{
				if(IsPlayerConnected(otherID))
				{
					if(playerData[otherID][playerLoggedIn])
					{
						if(playerData[playerid][playerLevel] >= playerData[otherID][playerLevel])
						{
							// Send message to game
							new aMsg[300];
							GetPlayerName(otherID, playerName, sizeof(playerName));
							GetPlayerName(playerid, adminName, sizeof(adminName));
							GetPlayerIp(otherID, playersIP, sizeof(playersIP));
							new log[250];
							format(aMsg, sizeof(aMsg), "{FF0770}[ADMIN] {FFFFFF}%s(%i) has banned %s(%i) {FE9A2E}[REASON: %s]{FFFFFF}", playerData[playerid][playerNamee], playerid, playerData[otherID][playerNamee], otherID, reason);
							SendClientMessageToAll(COLOR_WHITE, aMsg);
							format(log, sizeof(log), "%s(%i) has banned %s(%i)", playerData[playerid][tempAdminName], playerid, playerName, otherID);
							SendAdminText(playerid, log);
							
							new banreason[350];
							format(banreason, sizeof(banreason), "INSERT INTO `playerbans` (`banned_by`, `banned_for`, `player_banned`, `player_ip`) VALUES ('%s', '%s', '%s', '%s')", adminName, reason, playerName, playersIP);
							mysql_query(banreason, MYSQL_ADD_BAN, playerid, connection);
							
							KickWithMessage(otherID, "[BANNED] You have been banned. You may appeal on Inexorablegaming.com");
						}
						else
						{
							SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}You cannot use this command on that player.");
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not logged in!");
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not online!");
				}
			}
		}
		else
		{
			return 0;
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}You must be logged in to use commands.");
	}
		
	return 1;
}



Re: Command help - thefirestate - 08.09.2016

Do you save the IP that the user was registered from somewhere in the actual user database?


Re: Command help - XHunterZ - 08.09.2016

ye I do


Re: Command help - thefirestate - 08.09.2016

Then use MySQL's select function to select all IPs that match the chosen player's registered ip and show it to the player. I can't really script it myself looking only at the /ban CMD.