[Nito] /pay command error
#3

pawn Код:
if(strcmp(cmd, "/pay", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
                        new tmp[256];
                        new idx;
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /pay [playerid/PartOfName] [amount]");
                return 1;
            }
            //giveplayerid = strval(tmp);
            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 (IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    if(PlayerInfo[giveplayerid][pLocal] == 106)
                    {
                        SendClientMessage(playerid, COLOR_GRAD1, "Command not allowed in this location");
                        return 1;
                    }
                    if (ProxDetectorS(5.0, playerid, giveplayerid))
                    {
                        if(giveplayerid == playerid)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "   You can not pay for yourself !");
                            return 1;
                        }
                        new y,m,d;
                        new h,mi,s;
                        getdate(y,m,d);
                        gettime(h,mi,s);
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        playermoney = GetPlayerMoney(playerid);
                        if (moneys > 0 && playermoney >= moneys)
                        {
                            if (playermoney > ScriptMoney[playerid])
                            {
                                if(admins == 0 || afkadmins == admins)
                                {
                                    format(string, sizeof(string), "%s (%d), Has been Banned by The Anticheat Peter Griffin for Possible Money Hacking.", sendername, playerid);
                                    SendClientMessageToAll(COLOR_NICERED, string);
                                    format(string, sizeof(string), "You have Been Banned by The Anticheat For Possible Weapon Money Hacking ($%d)",(GetPlayerMoney(playerid) - ScriptMoney[playerid]));
                                    SendClientMessage(playerid,COLOR_LIGHTBLUE, string);
                                    format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] Anticheat Has Banned %s for: Money Hacking",d,m,y,h,mi,s,sendername);
                                    BanLog(string);
                                    ScriptBan(playerid,999,"Money Hacks");
                                }
                                format(string, sizeof(string), "[PETER]: %s (%d) Is possibly Using Money Hacks; Check him inmediately!!", sendername,playerid);
                                SendAdminMessage(COLOR_YELLOW, string);
                                PlayerSuspicious[playerid] = 1;
                                PlayerMoneyHacking[playerid] = 1;
                                PlayerSuspiciousMoney[playerid] = (GetPlayerMoney(playerid) - ScriptMoney[playerid]);
                                PlayerGotSpottedRecently[playerid] = 1;
                                SetTimerEx("ResetAcWarn", 90000, 0, "i", playerid);
                                SendClientMessage(playerid, COLOR_CREAM, "* Transaction Stopped, you're probably on a cash inbalance, contact an administrator.");
                                return 1;
                            }
                            SafeGivePlayerMoney(playerid, (0 - moneys));
                            SafeGivePlayerMoney(giveplayerid, moneys);
                            format(string, sizeof(string), "** You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                            SendClientMessage(playerid, COLOR_GRAD1, string);
                            format(string, sizeof(string), "** You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
                            SendClientMessage(giveplayerid, COLOR_GRAD1, string);
                            format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s has paid $%d to %s",d,m,y,h,mi,s, sendername, moneys, giveplayer);
                            PayLog(string);
                            if(moneys >= 1000000)
                            {
                                format(string, sizeof(string),"[PETER]: %s (%d) Has Paid $%d To %s (%d).", sendername, playerid, moneys, giveplayer, giveplayerid);
                                SendAdminMessage(COLOR_YELLOW,string);
                            }
                            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_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            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.");
                    }
                }//invalid id
            }
            else
            {
                format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
                SendClientMessage(playerid, COLOR_GRAD1, string);
            }
        }
        return 1;
    }
pawn Код:
if(PlayerInfo[giveplayerid][pLocal] == 106)
                    {

replace there your admin code ...
Other i dont know.
Reply


Messages In This Thread
[Nito] /pay command error - by NitoPSG - 17.04.2011, 08:48
Re: [Nito] /pay command error - by NitoPSG - 17.04.2011, 09:00
Re: [Nito] /pay command error - by Gertin - 17.04.2011, 09:49

Forum Jump:


Users browsing this thread: 2 Guest(s)