Help with range
#1

I was trying on making this command which is to give weapon to all players that are within the range of the value i give, but it gives only if the player is so near to me regardless of what value i give as range. I know the code is a mess, could anyone help find or rewrite the code, would really apreciate it
pawn Код:
new tmp[256], tmp2[256], Index, aweaponrange;
        new ammo, weap, WeapName[32], filestring[75];
        new string[128];
        tmp = strtok(params,Index);
        tmp2 = strtok(params,Index);
        aweaponrange = strval(params);

        if(isnull(params)) return
        SendClientMessage(playerid, LIGHTBLUE2, "Usage: /rangeweapon [WeaponID or WeaponName] [Ammo] [Range]");
       

        if(!strlen(tmp2) || !IsNumeric(tmp2) || strval(tmp2) <= 0 || strval(tmp2) > 99999) ammo = 500; else ammo = strval(tmp2);
        if(!IsNumeric(tmp))
        weap = GetWeaponIDFromName(tmp);
        else weap = strval(tmp);
        if(!IsValidWeapon(weap))
        return SendClientMessage(playerid,red,"ERROR: Invalid Weapon ID");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(GetDistanceBetweenPlayers(playerid,i) < 10 && Specing[i] == 0)
            {
                if(IsPlayerConnected(i))
                {
                PlayerPlaySound(i,1057,0.0,0.0,0.0);
                GivePlayerWeapon(i,weap,ammo);
                }
            }
        }
Reply


Messages In This Thread
Help with range - by PundacheMakalae - 29.01.2018, 17:27
Re: Help with range - by RogueDrifter - 29.01.2018, 17:36
Re: Help with range - by PundacheMakalae - 29.01.2018, 17:56
Re: Help with range - by Mugala - 29.01.2018, 19:55

Forum Jump:


Users browsing this thread: 3 Guest(s)