/pay don't work!
#3

Quote:
Originally Posted by Chriham3
My /pay don't work!
here is my code:

PS: I'm ****ing tired people PM me to use sscanf or dcmd, I like the OLD best!
pawn Код:
if(strcmp(cmdtext, "/pay", true) == 0)
    {
        new tmp[128];
        new giveplayerid;
        new giveplayer[MAX_PLAYER_NAME];
        new idx;
        new moneys;
        new playermoney;
        new sendername[MAX_PLAYER_NAME];
        new string[128];
       
      if(IsPlayerConnected(playerid))
      {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /pay [playerid/PartOfName] [amount]");
                return 1;
            }
        giveplayerid = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /pay [playerid/PartOfName] [amount]");
                return 1;
            }
            moneys = strval(tmp);
            if(moneys < 1 || moneys > 99999)
            {
              SendClientMessage(playerid, COLOR_GRAD1, "Dont go below 1, or above 99999 at once.");
              return 1;
            }
            if (IsPlayerConnected(giveplayerid))
            {
              if(giveplayerid != INVALID_PLAYER_ID)
              {
                    if (ProxDetectorS(5.0, playerid, giveplayerid))
                    {
                      if(giveplayerid == playerid)
                      {
                        SendClientMessage(playerid, COLOR_GREY, " You can not pay for yourself !");
                        return 1;
                      }
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        playermoney = GetPlayerMoney(playerid);
                        if (moneys > 0 && playermoney >= moneys)
                        {
                            GivePlayerMoney(playerid, - moneys);
                            GivePlayerMoney(giveplayerid, moneys);
                            PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
                            format(string, sizeof(string), "* %s takes out some cash, and hands it to %s.", sendername ,giveplayer);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            ApplyAnimation(playerid,"DEALER","shop_pay",4.1,0,0,0,0,0);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GRAD1, " Invalid transaction amount.");
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GRAD1, " Your too far away.");
                    }
                }
            }
            else
            {
                format(string, sizeof(string), " %d is not an active player.", giveplayerid);
                SendClientMessage(playerid, COLOR_GRAD1, string);
            }
        }
        return 1;
    }
Reply


Messages In This Thread
/pay don't work! - by Chriham3 - 14.03.2010, 19:38
/pay don't work! - by Chriham3 - 14.03.2010, 21:15
Re: /pay don't work! - by Razvann - 14.03.2010, 21:20

Forum Jump:


Users browsing this thread: 1 Guest(s)