Jump to content

math.random


LucasBaker

Recommended Posts

function spawnArmas() 
    giveWeapon(source, 24, 200) - Desert Eagle 
    giveWeapon(source, math.random(26,27), 200) - Sawn ou Spaz 
    giveWeapon(source, math.random(30,31), 200) - M4 ou AK 
end 
addEventHandler("onPlayerSpawn", getRootElement(), spawnArmas) 

Link to comment

Comments are written with

-- 

so it should look like

function spawnArmas (player) 
giveWeapon ( player, 24, 200 ) -- Desert Eagle 
giveWeapon ( player, math.random(26,27), 200 ) -- Sawn ou Spaz 
giveWeapon ( player, math.random(30,31), 200 ) -- M4 ou AK 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), spawnArmas ) 

Link to comment
function spawnArmas() 
    giveWeapon(source, 24, 200) - Desert Eagle 
    giveWeapon(source, math.random(26,27), 200) - Sawn ou Spaz 
    giveWeapon(source, math.random(30,31), 200) - M4 ou AK 
end 
addEventHandler("onPlayerSpawn", getRootElement(), spawnArmas) 

in / debugscript gets this error

x48f.png

thankss

Edited by Guest
Link to comment

This

Comments are written with
-- 

so it should look like

function spawnArmas (player) 
giveWeapon ( player, 24, 200 ) -- Desert Eagle 
giveWeapon ( player, math.random(26,27), 200 ) -- Sawn ou Spaz 
giveWeapon ( player, math.random(30,31), 200 ) -- M4 ou AK 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), spawnArmas ) 

Link to comment

That's right @Chronic, but first parameter for event the onPlayerSpawn is position X not a player.

function spawnArmas() 
    giveWeapon(source, 24, 200) -- Desert Eagle 
    giveWeapon(source, math.random(26,27), 200) -- Sawn ou Spaz 
    giveWeapon(source, math.random(30,31), 200) -- M4 ou AK 
end 
addEventHandler("onPlayerSpawn", getRootElement(), spawnArmas) 

Link to comment
That's right @Chronic, but first parameter for event the onPlayerSpawn is position X not a player.
function spawnArmas() 
    giveWeapon(source, 24, 200) -- Desert Eagle 
    giveWeapon(source, math.random(26,27), 200) -- Sawn ou Spaz 
    giveWeapon(source, math.random(30,31), 200) -- M4 ou AK 
end 
addEventHandler("onPlayerSpawn", getRootElement(), spawnArmas) 

Ah yes you're right, I was just giving the solution to his debug error :)

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...