ReturnUser going crazy?
#1

I don't know why , but it seems like the id's and name's are wrong on my server?


For example:

i'm typing /givegun hurdock 24 50 = > The Server gives gun to player 'cata'
screen:
http://i.imgur.com/QJ5fJ4p.png

command :

pawn Код:
if(strcmp(cmd, "/givegun", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /givegun [playerid/PartOfName] [weaponid(eg. 46 = Parachute)] [ammo]");
                return 1;
            }
            new playa;
            new gun;
            new ammo;
            playa = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            gun = strval(tmp);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /givegun [playerid/PartOfName] [weaponid] [ammo]");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            ammo = strval(tmp);
            if(ammo <1||ammo > 9999) return 1;
            if (PlayerInfo[playerid][pAdmin] >= 1)
            {
                if(IsPlayerConnected(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                        GiveGun(playa, gun, ammo);
                        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        format(string,sizeof(string), "%s a primit arma cu id %d de la %s ", GetName(giveplayerid), gun, GetName(playerid));
                        TrimiteEchipa(string);
                        format(string, sizeof(string), "{e53535}(Informatie necesarг){FF6633} ai primit arma cu id %d de la %s",gun , GetName(playerid));
                        SendClientMessage(giveplayerid, -1, string);

                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "you are not authorized to use that command!");
            }
        }
        return 1;
    }
... how can i fix it .. why is happen this.. ? last week problems like this didn't exist
Reply
#2

Why are you still bothering with this? All these functions were invented way back in 2007 or so when people didn't know any better. Granted, converting to a more modern command processor is a lot of work but implementing sscanf is not that hard.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)