ZCMD issue.
#5

Exemple:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{  
    if(strcmp(cmd, "/givecash", true) == 0) {
        new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
            return 1;
        }
        giveplayerid = strval(tmp);
       
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
            return 1;
        }
        moneys = strval(tmp);
       
        //printf("givecash_command: %d %d",giveplayerid,moneys);

       
        if (IsPlayerConnected(giveplayerid)) {
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            playermoney = GetPlayerMoney(playerid);
            if (moneys > 0 && playermoney >= moneys) {
                GivePlayerMoney(playerid, (0 - moneys));
                GivePlayerMoney(giveplayerid, moneys);
                format(string, sizeof(string), "You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
                SendClientMessage(playerid, COLOR_YELLOW, string);
                format(string, sizeof(string), "You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
                SendClientMessage(giveplayerid, COLOR_YELLOW, string);
                printf("%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
            }
            else {
                SendClientMessage(playerid, COLOR_YELLOW, "Invalid transaction amount.");
            }
        }
        else {
                format(string, sizeof(string), "%d is not an active player.", giveplayerid);
                SendClientMessage(playerid, COLOR_YELLOW, string);
            }
        return 1;
    }
   
    // PROCESS OTHER COMMANDS
   
   
    return 0;
}


COMMAND:test(playerid, params[])
{
      SendClientMessage(playerid COLOR_RED, " WEWEWE");
      return true; // you can put true or 1
}
Reply


Messages In This Thread
ZCMD issue. - by DiddyBop - 14.11.2010, 00:21
Re: ZCMD issue. - by Brian_Furious - 14.11.2010, 00:32
Re: ZCMD issue. - by DiddyBop - 14.11.2010, 00:34
Re: ZCMD issue. - by GaGlets(R) - 14.11.2010, 00:35
Re: ZCMD issue. - by Brian_Furious - 14.11.2010, 00:37
Re: ZCMD issue. - by DiddyBop - 14.11.2010, 00:37
Re: ZCMD issue. - by Brian_Furious - 14.11.2010, 00:39
Re: ZCMD issue. - by DiddyBop - 14.11.2010, 00:41
Re: ZCMD issue. - by Haydz - 14.11.2010, 00:44
Re: ZCMD issue. - by [L3th4l] - 14.11.2010, 00:49

Forum Jump:


Users browsing this thread: 1 Guest(s)