Jump to content

help


Apo

Recommended Posts

Provide more informations, we can't read in your mind. Tell us the errors/warnings if there are, tell us if the server is a default server and if there's a resource causing this. Also give a title that represents the issue, "help" is way too much generic

Edited by LoPollo
  • Like 1
Link to comment
  1. my warning line (setWeaponProperty( id , "std", "maximum_clip_ammo", ammo))

    WARNING:weapon.lua:40: Expected number, got non-convertible string. This warning may be an error in future versions.

    WARNING: weapon.lua:40: Expected number, got non-convertible string. This warning may be an error in future versions.  [DUP x6]

  2. function getAmmoPerClip(id)
    	if id == 0 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.fist' ))
    	elseif id == 1 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.brassknuckle' ))
    	elseif id == 2 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.golfclub' ))
    	elseif id == 3 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.nightstick' ))
    	elseif id == 4 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.knife' ))
    	elseif id == 5 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.bat' ))
    	elseif id == 6 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.shovel' ))
    	elseif id == 7 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.poolstick' ))
    	elseif id == 8 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.katana' ))
    	elseif id == 9 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.chainsaw' ))
    	elseif id == 10 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.dildo' ))
    	elseif id == 11 then
    		return tostring(get( getResourceName( getThisResource( ) ).. 'dildo2' ))
    	elseif id == 12 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.vibrator' ))
    	elseif id == 13 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.vibrator2' ))
    	elseif id == 14 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.flower' ))
    	elseif id == 15 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.cane' ))
    	elseif id == 16 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.grenade' ))
    	elseif id == 17 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.teargas' ))
    	elseif id == 18 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.molotov' ))
    	elseif id == 22 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.colt45' ))
    	elseif id == 23 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.silenced' ))
    	elseif id == 24 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.deagle' ))
    	elseif id == 25 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.shotgun' ))
    	elseif id == 26 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.sawed-off' ))
    	elseif id == 27 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.combatshotgun' ))
    	elseif id == 28 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.uzi' ))
    	elseif id == 29 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.mp5' ))
    	elseif id == 30 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.ak-47' ))
    	elseif id == 31 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.m4' ))
    	elseif id == 32 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.tec-9' ))
    	elseif id == 33 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.rifle' ))
    	elseif id == 34 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.sniper' ))
    	elseif id == 35 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.rocketlauncher' ))
    	elseif id == 41 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.spraycan' ))
    	elseif id == 42 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.fireextinguisher' ))
    	elseif id == 43 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.camera' ))
    	elseif id == 44 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.nightvision' ))
    	elseif id == 45 then
    		return tostring(get( getResourceName( getThisResource( ) ).. '.infrared' ))
    	else
    		return "disabled"
    	end
    	return "disabled"
    end
    
    
    function weaponpro()
    	for id = 0, 45, 1 do
    		if id ~= 19 and id ~= 20 and id ~=21 then
    			local ammo = getAmmoPerClip(id)
    			if ammo == "disable" then
    				setWeaponProperty( id , "std", "maximum_clip_ammo", 0)
    			else
    				setWeaponProperty( id , "std", "maximum_clip_ammo", ammo)
    			end
    		end
    	end
    end
    addEventHandler ( "onResourceStart", getRootElement(), weaponpro )

     

 

Edited by Apo
Link to comment

no sry line 92

WARNING:weapon.lua:92: Expected number, got non-convertible string. This warning may be an error in future versions.

WARNING: weapon.lua:92: Expected number, got non-convertible string. This warning may be an error in future versions.  [DUP x6]

setWeaponProperty( id , "std", "maximum_clip_ammo", ammo)
Link to comment
setWeaponProperty ( id, "std", "maximum_clip_ammo", tonumber(ammo) )

Should resolve the issue, though I've never come across a "non-convertible string". What does the value for 'ammo' look like at runtime?

Edited by Callum
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...