Hopeless I need an uregent help please.
#1

I made that script, again trying to make it work but IT DOESN'T .
I made a /frisk command but It doesn't work well, It shows the result like this it writes Empty more then 5 times, even though I wrote only once.
Can any one help me fixing the code, so that it won't show 8 messages of "1. Empty" and then 8 messages of "1.Empty" and one with the gun.
pawn Код:
if(strcmp(cmd, "/checkweapon", true) == 0)
    {
        if (PlayerInfo[playerid][pAdmin] < 1)
        {
            SendClientMessage(playerid, COLOR_GREY, "You are not authorized");
            return 1;
        }
        tmp = strtok(cmdtext,idx);
        if (!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GREY, "USAGE: /checkweapon [playerid/partOfName]");
            return 1;
        }
        giveplayerid = ReturnUser(tmp);
        if (giveplayerid == INVALID_PLAYER_ID)
        {
            SendClientMessage(playerid, COLOR_GREY, "That player is offline");
            return 1;
        }
        new sweapon, sammo;
        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
        format(string, sizeof(string), "%s has the following weapons:", giveplayer);
        SendClientMessage(playerid, COLOR_GRAD1, string);
        for (new i=0; i<9; i++)
        {
            GetPlayerWeaponData(giveplayerid, i, sweapon, sammo);
            if(sweapon != 0)
            {
                format(string, sizeof(string), "%d: %d (%d)", i, sweapon, sammo);
                SendClientMessage(playerid, COLOR_GRAD1, string);
               
        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "1. Empty");
                        }
        }
        return 1;
    }
Reply
#2

Anyone please I have been trying since yesterday I can't make it work,.
Reply
#3

You are sending the message within the loop, which repeats till i = 9 (9 - 0 = 9, aka 9 times)
Reply
#4

It changed it, but now when I try to frisk it just says : 1.Empty, even If I have a weapon.
Reply
#5

Anyone please I can't make it work, It has been like that since Wednesday.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)