why wont my command work?
#1

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;
}
Reply
#2

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...
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)