Why this command no works?
#1

I try make command givecash with dcmd, the command and all the script in give error, but ingame no see the money, when i write /givecash say "Money send" But when i write /givecash (id) (ammont) say me "Usage: /givecas [playerid/name] [ammount]

can someone help me?

Код:
dcmd_givecash(playerid, params[])
{
	new
		giveplayerid,
		amount;
	if (sscanf(params, "ud", giveplayerid, amount)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /givecash [playerid/partname] [amount]");
	else if (giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
	else if (amount > GetPlayerMoney(playerid)) SendClientMessage(playerid, 0xFF0000AA, "Insufficient Funds");
	else
	{
		GivePlayerMoney(giveplayerid, amount);
		GivePlayerMoney(playerid, 0 - amount);
		SendClientMessage(playerid, 0x00FF00AA, "Money sent");
		SendClientMessage(giveplayerid, 0x00FF00AA, "Money recieved");
	}
	return 1;
}
Reply
#2

Sorro for the double post, but i search this about 2 weeks, and i are crazy, i need command /givecash player to player

someone have one?

If is in dcmd better

Thanks
Reply
#3

You didn't make it.

https://sampwiki.blast.hk/wiki/Dcmd
Reply
#4

Quote:
Originally Posted by [B
Vortex ]
You didn't make it.

https://sampwiki.blast.hk/wiki/Dcmd
I try with this command... but no is works, i think someone edit that for cant send money
Reply
#5

try this:

Код:
dcmd_givecash(playerid, params[])
{
	new tmp[256], tmp2[256],Index;
	tmp = strtok(params,Index);
	tmp2 = strtok(params,Index);
	
	new otherid = strval(tmp);
	new amount = strval(tmp2);
	
	if (strlen(tmp) && strlen(tmp2))
	{
		if (IsPlayerConnected(otherid))
		{
			if (GetPlayerMoney(playerid) >= amount)
			{
				new string[256], string2[256], name[MAX_PLAYER_NAME], oname[MAX_PLAYER_NAME];
				
				GetPlayerName(playerid, name, sizeof(name));
				GetPlayerName(otherid, oname, sizeof(oname));
				
				GivePlayerMoney(playerid, GetPlayerMoney(playerid)-amount);
				GivePlayerMoney(otherid, amount);		
				
				format(string, sizeof(string), "You have sent %s $%d.", oname, amount);
				format(string2, sizeof(string2), "%s has sent you $%d.", name, amount);
				
				SendClientMessage(playerid, COLOR, string);
				SendClientMessage(otherid, COLOR, string2);
			}
			else
			{
				SendClientMessage(playerid, COLOR, "You dont have that amount of cash.");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR, "Invalid player id.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR, "USAGE: /givecash [playerid] [amount]");
	}
}
Untested.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)