/minuscash /minusscore
#1

Can you please help me make a /minuscash and /minusscore out of this script below?

Код:
COMMAND:givecash(playerid, params[])
{
	if(PlayerInfo[playerid][AdminLevel] >= LEVEL_givecash)
	{
	    new player, amount;
	    if(sscanf(params, "ui", player, amount))
	    {
         	GameTextForPlayer(playerid, "~g~/givecash ~w~<id/name> <amount>", 3000, 3);
	        return 1;
	    }

		if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
		{
			new string[128];
			format(string,sizeof(string),"%s(%d) has given you cash of $%d", GetName(playerid), playerid, amount);
			SendClientMessage(player, GREY, string);
			format(string,sizeof(string),"You gave %s(%d) a cash of $%d", GetName(player), player, amount);
			SendClientMessage(playerid, GREY, string);
			GivePlayerMoney(player, amount);
		}
		else
		{
			GameTextForPlayer(playerid, "~r~Player is unavailable", 3000, 3);
		}
	}
	else
	{
		SendClientMessage(playerid, RED, NO_PERM);
	}
	return 1;
}
Код:
COMMAND:givescore(playerid,params[])
{
	if(PlayerInfo[playerid][AdminLevel] >= LEVEL_givescore)
	{
	    new player, amount;
	    if(sscanf(params, "ui", player, amount))
	    {
         	GameTextForPlayer(playerid, "~g~/givescore ~w~<name/id> <score>", 3000, 3);
	        return 1;
	    }
		if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
		{
			new string[128];
			if(player != playerid)
			{
				format(string,sizeof(string),"%s(%d) has given you a score of %d", GetName(playerid), playerid,amount);
				SendClientMessage(player,GREY,string);
				format(string,sizeof(string),"You gave %s(%d) a score of %d",GetName(player), player);
				SendClientMessage(playerid,GREY,string);
			}
			else
			{
				format(string,sizeof(string),"You give yourself a score of %d",amount);
				SendClientMessage(playerid,GREY,string);
			}
   			SetPlayerScore(player, GetPlayerScore(player)+ amount);
		}
	 	else
	 	{
		 	GameTextForPlayer(playerid, "~r~player is unavailable", 3000, 3);
		}
	}
	else
	{
		SendClientMessage(playerid, RED, NO_PERM);
	}
	UpdateMySQLScore(playerid);
	return 1;
}
Reply
#2

Couldn't you just use the command you already have but put a minus with the amount.. eg:

/givescore id -10 // Gives -10 score?
and
/givecash id -10 // Gives -10 cash?
Reply
#3

pawn Код:
COMMAND:removecash(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= LEVEL_givecash)
    {
        new player, amount;
        if(sscanf(params, "ui", player, amount))
        {
            GameTextForPlayer(playerid, "~g~/removecash ~w~<id/name> <amount>", 3000, 3);
            return 1;
        }

        if(IsPlayerConnected(player) && player != INVALID_PLAYER_ID)
        {
            new string[128];
            format(string,sizeof(string),"%s(%d) has remove $%d of your cash", GetName(playerid), playerid, amount);
            SendClientMessage(player, GREY, string);
            format(string,sizeof(string),"You removed %s(%d) cash of $%d", GetName(player), player, amount);
            SendClientMessage(playerid, GREY, string);
            GivePlayerMoney(player, -amount);
        }
        else
        {
            GameTextForPlayer(playerid, "~r~Player is unavailable", 3000, 3);
        }
    }
    else
    {
        SendClientMessage(playerid, RED, NO_PERM);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)