[DooD]Heavyair Posted June 23, 2008 Share Posted June 23, 2008 (edited) i have got a script that activates the sam site at area 69 and fires at players using createObject and moveObject. i want to make the objects that it fires at player move a bit more randomly so that it doesnt allways hit the player. my player spawn function uses randInt to choose what skin player will have when he spawns as i only wanted a few of the skins but when i try to use it for my sam site in the same way i get a bad argument. the script im trying to use it in is client side so im not sure if thats the problem ( error is attempt to call randInt a nil value. here is the script client side function area69samsitefire ( player, matchingDimension ) detection = isElementWithinColShape ( getLocalPlayer(), area69samsphere ) if detection == true then if ( getTickCount () > previousTick + area69samfiredelay ) then local px,py,pz = getElementPosition ( getLocalPlayer() ) local glow1 = createMarker ( 353, 2030, 30, "corona", 5, 255, 0, 0, 150 ) local shot1 = createObject ( 3106, 353, 2030, 30 ) local rand = randInt ( 1,5 ) attachElementToElement ( glow1, shot1, 0, 0, 0 ) setTimer ( moveObject, 50, 1, shot1, 500, px + rand, py + rand, pz + rand ) setTimer ( destroyElement, 570, 1, shot1 ) setTimer ( destroyElement, 570, 1, glow1 ) previousTick = getTickCount() end end end i have tried setting the randInt in a few different ways but always the same error tried like this as this is how my player spawn skin randomizer works local offz = { 2, 3, 4, 5 } local rand = randInt ( 1, #offz ) also tried this which i saw in another script setTimer ( moveObject, 50, 1, shot1, px+randInt(1,5), py+randInt(1,5), pz+randInt(1,5) ) but no matter what all of them give me attempt to call randInt a nil value. i know its probably something simple but i just cant see it any advice appreciated thanx all Edited June 23, 2008 by Guest Link to comment
tma Posted June 23, 2008 Share Posted June 23, 2008 randInt() is server only. Try this instead: local rand = math.random(1,5) Link to comment
[DooD]Heavyair Posted June 23, 2008 Author Share Posted June 23, 2008 thanks tma. i will try that now EDIT ::: awesome tma works perfectly. thank u so much Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now