Problem with STRLEN & PAY COMMAND
#1

  • If i type /pay Mathew(for example) 50 , it gives 1$ not 50$ !
  • Or the !strlen don't work correct for example if i type /pay id moneys (correctly) it gives me !strlen but i type the moneys correct!
How i fix it ?
pawn Код:
if(strcmp(cmd, "/pay", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, -1, "{FFFFFF}(( {FFCC00}Exemplu folosire : {C0C0C0} /pay [playerid/nume jucator] [suma] {FFFFFF}))");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            moneys = strvalEx(tmp);
            if(strfind(tmp, "-", true) != -1)
            {
                SendClientMessage(playerid, -1, "{FFFFFF}(( {FFCC00}Exemplu folosire : {C0C0C0} /pay [playerid/nume jucator] [suma] {FFFFFF}))");
                return 1;
            }          
            if(moneys < 1 || moneys > 1000000)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "{FFFFFF}(( {FFCC00}Informatie -{C0C0C0} Suma minima 1$ - Suma maxima 1.000.000$ {FFFFFF}))");
                return 1;
            }
           
            if(IsPlayerConnected(giveplayerid))
            {
                //if(giveplayerid == playerid) { SendClientMessage(playerid, -1, "{FFFFFF}(( {FFCC00}Informatie - {C0C0C0} aceasta comanda trebuie executata pe alta persoana {FFFFFF}))"); return 1; }
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    if(ProxDetectorS(5.0, playerid, giveplayerid))
                    {
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        new playermoney = GetPlayerMoney(playerid);
                        if(moneys > 0 && playermoney >= moneys)
                        {
                            new string[250];
                            PlayerInfo[playerid][Valuta] = PlayerInfo[playerid][Valuta]-moneys;
                            GivePlayerMoney(playerid, (0 - moneys));
                            PlayerInfo[giveplayerid][Valuta] = PlayerInfo[giveplayerid][Valuta]+moneys;
                            GivePlayerMoney(giveplayerid, moneys);
                            format(string, sizeof(string), "* %s takes out some cash, and hands it to %s.",sendername,giveplayer);
                            ProxDetector(playerid, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, string);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                            PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
                            format(string, sizeof(string), "~r~-%d$",moneys);
                            GameTextForPlayer(playerid, string, 5000, 1);
                            format(string, sizeof(string), "~g~+%d$",moneys);
                            GameTextForPlayer(giveplayerid, string, 5000, 1);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GRAD1, "{FFFFFF}(( {FFCC00}Informatie -{C0C0C0} n-ai aceasta suma in posesie , din pacate! {FFFFFF}))");
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GRAD1, "{FFFFFF}(( {FFCC00}Informatie -{C0C0C0} trebuie sa stai langa jucator{FFFFFF}))");
                    }
                }
            }
            else
            {
                new string[256];
                format(string, sizeof(string), "{FFFFFF}(( {FFCC00}Informatie -{C0C0C0} jucatorul acesta este offline! {FFFFFF}))");
                SendClientMessage(playerid, COLOR_GRAD1, string);
            }
        }
        return 1;
    }
Reply
#2

Stop using outdated methods. I know what the culprit is, but I don't really have any intention to teach outdated, slow stuff.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)