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



Solved. - Ace_Menace - 29.06.2009

I am making a command, and can't seem to get passed the return 0; bit

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(fine, 4, cmdtext);
	return 0;
}

dcmd_fine(playerid, params[])
{
			new id,
			amount,
			reason[128],
			playername[MAX_PLAYER_NAME];
(46)		if (sscanf(params, "idz", id, amount, reason))
		return SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/fine <playerid> <amount> <reason>\""), 1;
		if ( ! IsPlayerConnected(id) ) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
		else
		{
			GetPlayerName(id, playername, MAX_PLAYER_NAME);
			format(reason, 127, "%s has been fined, $%d, for %s", playername, amount, reason);
			GivePlayerMoney(id, -amount);
			SendClientMessageToAll(0xFF0000AA, reason);
			SendClientMessage(playerid, 0xFF0000AA, "Player Fined");
		}
		return 1;
	}
(59)	return 0;
}
Код:
(46) : warning 217: loose indentation
(59) : error 010: invalid function or declaration



Re: [Help] Need Help with my Indentation! - James_Alex - 29.06.2009

try this
pawn Код:
dcmd_fine(playerid, params[])
{
        new id,
        amount,
        reason[128],
        playername[MAX_PLAYER_NAME];
        if (sscanf(params, "idz", id, amount, reason))
        return SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/fine <playerid> <amount> <reason>\""), 1;
        if ( ! IsPlayerConnected(id) ) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
        else
        {
            GetPlayerName(id, playername, MAX_PLAYER_NAME);
            format(reason, 127, "%s has been fined, $%d, for %s", playername, amount, reason);
            GivePlayerMoney(id, -amount);
            SendClientMessageToAll(0xFF0000AA, reason);
            SendClientMessage(playerid, 0xFF0000AA, "Player Fined");
        }
        return 1;
    }
    return 0;
}



Re: [Help] Need Help with my Indentation! - dice7 - 29.06.2009

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(fine, 4, cmdtext);
    return 0;
}

dcmd_fine(playerid, params[])
{
    new id,
    amount,
    reason[128],
    playername[MAX_PLAYER_NAME];
    if (sscanf(params, "idz", id, amount, reason)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/fine <playerid> <amount> <reason>\""), 1;
    if ( ! IsPlayerConnected(id) ) return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
    else
    {
        GetPlayerName(id, playername, MAX_PLAYER_NAME);
        format(reason, 127, "%s has been fined, $%d, for %s", playername, amount, reason);
        GivePlayerMoney(id, -amount);
        SendClientMessageToAll(0xFF0000AA, reason);
        SendClientMessage(playerid, 0xFF0000AA, "Player Fined");
        return 1;
    }
    return 0;
}



Re: [Help] Need Help with my Indentation! - Ace_Menace - 29.06.2009

@james alex - Thanks all better now, but For some reason I still get

the invalid function or decleration error on the
return 0;
part.


Re: [Help] Need Help with my Indentation! - dice7 - 29.06.2009

because it has an } to much


Solved - Ace_Menace - 30.06.2009

Solved!