Sharingan Posted July 5, 2011 Share Posted July 5, 2011 Hi all, I started today to learn Lua, I know Pawn, PHP, Javascript and a little of C++. I have 2 problems. I tried to increase the damage of the weapons, especialy M4, with OnPlayerDamage and setElementHealth, and failed. I'd like some example with how to do a random spawn. Link to comment
JR10 Posted July 5, 2011 Share Posted July 5, 2011 (edited) Hi there and welcome, you made the smartest decision of your life . Well you should show us the script so we can help. and here is how to pick a random spawn (make a table of them) and then use: local Spawns = { {0, 0, 0}, -- 0, 0, 0 are the coordinates of the spawn position {1, 1, 1}, {2, 2, 2}, --etc {5, 5, 5} } addEventHandler('onPlayerJoin', root, --When the player joins function() local x, y, z = unpack(Spawns[math.random(#Spawns)]) spawnPlayer(source, x, y, z) end ) And read this : http://lua-users.org/wiki/TablesTutorial Edited July 5, 2011 by Guest Link to comment
Castillo Posted July 5, 2011 Share Posted July 5, 2011 local mySpawnTable = { {-1285, -34, 15}, {1809, -2477, 14}, } addEventHandler("onPlayerJoin",root, function () local ran = math.random(#mySpawnTable) local x, y, z = mySpawnTable[ran][1], mySpawnTable[ran][2], mySpawnTable[ran][3] spawnPlayer(source, x, y, z) end) This will spawn the player in a random between Los Santos airport and San Fierro airport when they join. Link to comment
eAi Posted July 6, 2011 Share Posted July 6, 2011 Spawn points should be specified in map files really. 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