SA-MP Forums Archive
why wont my command work? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: why wont my command work? (/showthread.php?tid=217820)



why wont my command work? - Raz0r1000 - 28.01.2011

Ok, I have an unmute command (using sscanf) that crashes the server when i use it. If I just type '/unmute', then it shows the 'USAGE:' line, but if i type' /unmute 2' for example, then server crashes :/

Код:
COMMAND:unmute(playerid, params[])
{
	if(PlayerInfo[playerid][Admin] > 0)
	{
		new targetid, string[128];
		if(sscanf(params, "u", targetid)) SendUsage(playerid, "USAGE: /unmute [targetid]");
		else
		{
	        if(IsPlayerConnected(targetid))
	        {
				format(string, 128, "**(ADMIN UNMUTE)** %s(%d) has been unmuted by Admin '%s(%d)'", PlayerName(targetid), targetid);
				SendClientMessageToAll(COLOR_RED, string);
				PlayerInfo[targetid][Muted] = 0;
	        }
	        else
	        {
	            SendClientMessage(playerid, COLOR_WHITE, "ERROR: That player is not connected.");
	        }
		}
	}
	else SendErrorMessage(playerid);
	return 1;
}



****** - Mean - 28.01.2011

pawn Код:
COMMAND:unmute(playerid, params[])
{
    if(PlayerInfo[playerid][Admin] > 0)
    {
        new targetid, string[128];
        if(sscanf(params, "u", targetid)) return SendUsage(playerid, "USAGE: /unmute [targetid]");
        if(IsPlayerConnected(targetid))
        {
            format(string, 128, "**(ADMIN UNMUTE)** %s(%d) has been unmuted by Admin '%s(%d)'", PlayerName(targetid), targetid, PlayerName(playerid), playerid);
            SendClientMessageToAll(COLOR_RED, string);
            PlayerInfo[targetid][Muted] = 0;
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "ERROR: That player is not connected.");
        }
    }
    else SendErrorMessage(playerid);
    return 1;
}
You know, I woudn't mind knowing if it worked...


Re: why wont my command work? - Raz0r1000 - 29.01.2011

Oh yeah it works now, and I used the same fix for the /unfreeze command