HeK Posted April 1, 2012 Share Posted April 1, 2012 (edited) Hey guys i have made this Spawn/Respawn script, some issues i have is that on Spawn the player gets the guns, thats ok, but on respawn he has no guns anymore, anyway to fix that? Another problem is that when he dies, i wanted it to have fadeCamera then he respawns, but it doesn't work. My script: -- Spawn Player on Plane function spawn(prevA, curA, autoLogin) spawnPlayer ( source, -302.70001220703, 1437.9000244141, 835.70001220703, math.random (0,288), 0, 0 ) giveWeapon ( source, 46, 1 ) -- Parachute giveWeapon ( source, 25, 2500 ) -- Shotgun giveWeapon ( source, 22, 2000 ) -- Colt 45 fadeCamera ( source, true ) setCameraTarget ( source, source ) end addEventHandler( "onPlayerLogin", getRootElement(), spawn ) -- Respawn Player at Base addEventHandler( "onPlayerWasted", getRootElement( ), function() setTimer ( spawnPlayer, 5000, 1, source, -343.27581787109, 1537.6356201172, 75.5626, 180 ) end ) Edited April 1, 2012 by Guest Link to comment
Castillo Posted April 1, 2012 Share Posted April 1, 2012 local guns = { [ 46 ] = 1, [ 25 ] = 2500, [ 22 ] = 2000 } -- Spawn Player on Plane function spawn ( prevA, curA, autoLogin ) spawnPlayer ( source, -302.70001220703, 1437.9000244141, 835.70001220703, math.random (0,288), 0, 0 ) fadeCamera ( source, true ) setCameraTarget ( source, source ) end addEventHandler( "onPlayerLogin", getRootElement(), spawn ) -- Respawn Player at Base addEventHandler( "onPlayerWasted", getRootElement( ), function ( ) setTimer ( spawnPlayer, 5000, 1, source, -343.27581787109, 1537.6356201172, 75.5626, 180 ) end ) addEventHandler ( "onPlayerSpawn", root, function ( ) for weapon, ammo in pairs ( guns ) do giveWeapon ( source, weapon, ammo ) end end ) Link to comment
HeK Posted April 1, 2012 Author Share Posted April 1, 2012 Thanks, but what if the player goes to a gun shop and buys some guns, how can i make it that those guns that they buyed are saved? Link to comment
Castillo Posted April 1, 2012 Share Posted April 1, 2012 You can use a lua table to save player weapons on wasted. Link to comment
HeK Posted April 1, 2012 Author Share Posted April 1, 2012 Thanks, i'll do that. I just need another thing, is there anyway to make the "first" spawn only for first time players, for example, first time player joins the server they start on the "plane" and then they jump etc, next time they login they are at the position they left. Link to comment
Castillo Posted April 1, 2012 Share Posted April 1, 2012 You must save if it's his/her first time on a database system, could be account data, then check it when he/she logs in. 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