/givecash [playername (not playerid)] [money] - 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: /givecash [playername (not playerid)] [money] (
/showthread.php?tid=253894)
/givecash [playername (not playerid)] [money] -
Vvolk - 08.05.2011
Please someone give me code to make /givecash [playername] [money] command.I've tried to make this cmd,but it was very bugy . I will be very grateful.
Re: /givecash [playername (not playerid)] [money] -
MadeMan - 08.05.2011
Use sscanf
https://sampforum.blast.hk/showthread.php?tid=120356
Re: /givecash [playername (not playerid)] [money] -
Biesmen - 08.05.2011
If you're someone who really cares about a command going 0.00100 second faster than DCMD, and you can't be bothered to "define" a command, use ZCMD.
Use SSCANF2.
pawn Код:
#include <sscanf2>
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(givecash, 8, cmdtext);
return 1;
}
Somewhere in your script,
not in a callback:
pawn Код:
dcmd_givecash(playerid, params[])
{
new giveplayerid, money;
if(sscanf(params, "ui", giveplayerid, money)) return SendClientMessage(playerid, -1, "Usage: /givecash [playerid/PartOfname] [money]");
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, -1, "This player is not connected.");
GivePlayerMoney(giveplayerid, money);
SendClientMessage(playerid, -1, "You've sent someone cash.");
SendClientMessage(giveplayerid, -1, "You recieved cash.");
return 1;
}