/fine doesnt show reason
#1

Why doesnt it print out the reason when i fine someone?
Код:
COMMAND:fine(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 8)
	{
 		SendClientMessage(playerid, COLOR_GREY, "You must be a level 8 admin to do this.");
	}
	else
	{
	    new targetid;
 		new amount;
 		new playername[30];
 		new targetname[30];
 		new reason[128];
 		new result[200];
 		GetPlayerName(targetid, targetname, sizeof(targetname));
 		GetPlayerName(playerid, playername, sizeof(playername));
 		if(sscanf(params, "uis", targetid, amount)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /fine [ID] [AMOUNT] [REASON]");
 		if(PlayerInfo[targetid][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_GREY, "That players admin level is higher than yours.");
 		if(amount < 1) return SendClientMessage(playerid, COLOR_GREY, "The amount to fine can't be less than 1.");
 		GivePlayerMoney(targetid, -amount);
 		format(result, sizeof(result),"%s was fined $%i by %s, reason: {F5712A}%s", targetname, amount, playername, reason);
 		SendClientMessageToAll(COLOR_RED, result);
	}
	return 1;
}
Reply
#2

pawn Код:
COMMAND:fine(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 8)
    {
        SendClientMessage(playerid, COLOR_GREY, "You must be a level 8 admin to do this.");
    }
    else
    {
           
        new targetid;
        new amount;
        new playername[30];
        new targetname[30];
        new reason[128];
        new result[200];
        GetPlayerName(targetid, targetname, sizeof(targetname));
        GetPlayerName(playerid, playername, sizeof(playername));
        if(sscanf(params, "uic", targetid, amount,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /fine [ID] [AMOUNT] [REASON]");
        if(PlayerInfo[targetid][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_GREY, "That players admin level is higher than yours.");
        if(amount < 1) return SendClientMessage(playerid, COLOR_GREY, "The amount to fine can't be less than 1.");
        GivePlayerMoney(targetid, -amount);
        format(result, sizeof(result),"%s was fined $%i by %s, reason: {F5712A}%s", targetname, amount, playername, params[3]);
        SendClientMessageToAll(COLOR_RED, result);
    }
    return 1;
}
Reply
#3

This should fix it:

pawn Код:
COMMAND:fine(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 8)
    {
        SendClientMessage(playerid, COLOR_GREY, "You must be a level 8 admin to do this.");
    }
    else
    {
        new targetid;
        new amount;
        new playername[30];
        new targetname[30];
        new reason[128];
        new result[200];
        GetPlayerName(targetid, targetname, sizeof(targetname));
        GetPlayerName(playerid, playername, sizeof(playername));
        if(sscanf(params, "uis[128]", targetid, amount, reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /fine [ID] [AMOUNT] [REASON]");
        if(PlayerInfo[targetid][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_GREY, "That players admin level is higher than yours.");
        if(amount < 1) return SendClientMessage(playerid, COLOR_GREY, "The amount to fine can't be less than 1.");
        GivePlayerMoney(targetid, -amount);
        format(result, sizeof(result),"%s was fined $%i by %s, reason: {F5712A}%s", targetname, amount, playername, reason);
        SendClientMessageToAll(COLOR_RED, result);
    }
    return 1;
}
Reply
#4

Try This :
pawn Код:
COMMAND:fine(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 8)
    {
        SendClientMessage(playerid, COLOR_GREY, "You must be a level 8 admin to do this.");
    }
    else
    {
        new targetid;
        new amount;
        new playername[30];
        new targetname[30];
        new reason[128];
        new result[200];
        GetPlayerName(targetid, targetname, sizeof(targetname));
        GetPlayerName(playerid, playername, sizeof(playername));
        if(sscanf(params, "uic[128]", targetid, amount, reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /fine [ID] [AMOUNT] [REASON]");
        if(PlayerInfo[targetid][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_GREY, "That players admin level is higher than yours.");
        if(amount < 1) return SendClientMessage(playerid, COLOR_GREY, "The amount to fine can't be less than 1.");
        GivePlayerMoney(targetid, -amount);
        format(result, sizeof(result),"%s was fined $%i by %s, reason: {F5712A}%s", targetname, amount, playername, reason);
        SendClientMessageToAll(COLOR_RED, result);
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by Sellize
Посмотреть сообщение
Why doesnt it print out the reason when i fine someone?
Код:
COMMAND:fine(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 8)
	{
 		SendClientMessage(playerid, COLOR_GREY, "You must be a level 8 admin to do this.");
	}
	else
	{
	    new targetid;
 		new amount;
 		new playername[30];
 		new targetname[30];
 		new reason[128];
 		new result[200];
 		GetPlayerName(targetid, targetname, sizeof(targetname));
 		GetPlayerName(playerid, playername, sizeof(playername));
 		if(sscanf(params, "uis", targetid, amount)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /fine [ID] [AMOUNT] [REASON]");
 		if(PlayerInfo[targetid][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_GREY, "That players admin level is higher than yours.");
 		if(amount < 1) return SendClientMessage(playerid, COLOR_GREY, "The amount to fine can't be less than 1.");
 		GivePlayerMoney(targetid, -amount);
 		format(result, sizeof(result),"%s was fined $%i by %s, reason: {F5712A}%s", targetname, amount, playername, reason);
 		SendClientMessageToAll(COLOR_RED, result);
	}
	return 1;
}
if(sscanf(params, "uis", targetid, amount))
You miss wrote the reason inside the sscanf:
if(sscanf(params, "uis[128]", targetid, amount, reason))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)