dcmd_givecash < sending wrong message - 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: dcmd_givecash < sending wrong message (
/showthread.php?tid=136923)
dcmd_givecash < sending wrong message -
Andy_McKinley - 27.03.2010
This is my command givecash and when I sen someone $5000 it shows $2 or $0. Anyway, it's wrong and I don't know what's causing it, the money increases with 5000 but it shows the wrong message.
pawn Код:
dcmd_givecash(playerid, params[])
{
new amount, str[128];
if(sscanf(params, "ud", giveplayerid, amount)) return SystemMessage(playerid, "USAGE: /givecash [playername/id] [amount]");
if(!IsPlayerConnected(giveplayerid) || giveplayerid == playerid) return SystemMessage(playerid, "This player is not active.");
if(amount < 1 || amount > GetPlayerMoney(playerid)) return SystemMessage(playerid, "Invalid amount.");
GetName(playerid, playername);
GetName(giveplayerid, giveplayer);
GivePlayerMoney(playerid, -amount);
GivePlayerMoney(giveplayerid, amount);
format(str, sizeof(str), "You have given $%d to %s.", amount, giveplayer, giveplayerid);
SystemMessage(playerid, str);
format(str, sizeof(str), "%s has given you $%d.", playername, playerid, amount);
SystemMessage(giveplayerid, str);
return 1;
}
Re: dcmd_givecash < sending wrong message -
Sebago[X] - 27.03.2010
Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Put this code on your mode.
Re: dcmd_givecash < sending wrong message -
Andy_McKinley - 27.03.2010
Quote:
Originally Posted by Sebago[X
]
Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Put this code on your mode.
|
... I already have that one in my script.
Re: dcmd_givecash < sending wrong message -
cessil - 27.03.2010
Quote:
Originally Posted by DarkPhoenix
This is my command givecash and when I sen someone $5000 it shows $2 or $0. Anyway, it's wrong and I don't know what's causing it, the money increases with 5000 but it shows the wrong message.
pawn Код:
format(str, sizeof(str), "%s has given you $%d.", playername, playerid, amount);
|
that's formatting "playername has given you $playerid" which if the playerid is 0 gives you $0 and if the playerid is 2 gives you $2
Re: dcmd_givecash < sending wrong message -
Andy_McKinley - 27.03.2010
Quote:
Originally Posted by cessil
Quote:
Originally Posted by DarkPhoenix
This is my command givecash and when I sen someone $5000 it shows $2 or $0. Anyway, it's wrong and I don't know what's causing it, the money increases with 5000 but it shows the wrong message.
pawn Код:
format(str, sizeof(str), "%s has given you $%d.", playername, playerid, amount);
|
that's formatting "playername has given you $playerid" which if the playerid is 0 gives you $0 and if the playerid is 2 gives you $2
|
So it will be fine if I use this?
pawn Код:
format(str, sizeof(str), "%s has given you $%d.", playername, amount);
Re: dcmd_givecash < sending wrong message -
Burridge - 27.03.2010
Quote:
Originally Posted by DarkPhoenix
So it will be fine if I use this?
pawn Код:
format(str, sizeof(str), "%s has given you $%d.", playername, amount);
|
Yeah, that will work. (AFAIK).
Re: dcmd_givecash < sending wrong message -
jamesbond007 - 27.03.2010
Код:
format(str, sizeof(str), "You have given $%d to %s.", amount, giveplayer);
SystemMessage(playerid, str);
format(str, sizeof(str), "%s has given you $%d.", playername, amount);
SystemMessage(giveplayerid, str);
im sure this is right, test it out
Re: dcmd_givecash < sending wrong message -
jamesbond007 - 27.03.2010
.