/givecash [playername (not playerid)] [money]
#1

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.
Reply
#2

Use sscanf

https://sampforum.blast.hk/showthread.php?tid=120356
Reply
#3

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)