how to pay other players
#8

You use old methods for commands like strcmp?If not,this is my ZCMD givemoney command i use in my cnr gamemode.

pawn Код:
CMD:gm(playerid, params[])
{
    new Destinationid,Ammount,PlayerName[24],DestName[24],String[128];
    if(GetPVarInt(playerid,"GmTime")>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"Please wait 5 seconds before giving money again.");
    SetPVarInt(playerid,"GmTime",GetTickCount()+5000);
    if (sscanf(params, "ui", Destinationid, Ammount)) return SendClientMessage(playerid, -1, "Usage: /givemoney <playerid> <ammount>");
    if (!IsPlayerConnected(Destinationid)) return SendClientMessage(playerid, -1, "Player is not connected.");
    if (GetPlayerMoney(playerid) < Ammount) return SendClientMessage(playerid, -1, "Insufficent funds.");
    if(playerid == Destinationid) return SendClientMessage(playerid,red, "You can't send money to yourself.");
    GetPlayerName(playerid, PlayerName, 24);
    GetPlayerName(Destinationid, DestName, 24);
    format(String, 128, "%s (%d) has sent you %d$", PlayerName, playerid, Ammount);
    SendClientMessage(Destinationid, -1, String);
    new gmsent[128];
    format(gmsent,sizeof(gmsent),"Sent %d$ to %s (%d)", Ammount,DestName,Destinationid);
    GameTextForPlayer(playerid,gmsent,3000,5);
    format(String, 128, "You've sent %d$ to %s (%d)", Ammount, DestName, Destinationid);
    SendClientMessage(playerid, -1, String);
    new gmrec[128];
    format(gmrec,sizeof(gmrec),"Received %d$ from %s (%d)", Ammount,PlayerName,Destinationid);
    GameTextForPlayer(Destinationid,gmrec,3000,5);
    GivePlayerMoney(Destinationid, Ammount);
    GivePlayerMoney(playerid, -Ammount);
    return 1;
}
Don't hesitate to ask if you've a problem with this.
Reply


Messages In This Thread
how to pay other players - by xXitsgodzillaXx - 20.04.2012, 21:42
Re: how to pay other players - by Mauzen - 20.04.2012, 21:44
Re: how to pay other players - by WarriorEd22 - 20.04.2012, 22:08
Re: how to pay other players - by xXitsgodzillaXx - 20.04.2012, 22:37
Re: how to pay other players - by xXitsgodzillaXx - 20.04.2012, 22:39
Re: how to pay other players - by sjvt - 20.04.2012, 22:43
Re: how to pay other players - by xXitsgodzillaXx - 20.04.2012, 22:53
Re: how to pay other players - by Face9000 - 20.04.2012, 23:58
Re: how to pay other players - by xXitsgodzillaXx - 21.04.2012, 17:27
Re: how to pay other players - by xXitsgodzillaXx - 22.04.2012, 03:32

Forum Jump:


Users browsing this thread: 3 Guest(s)