Wumbaloo Posted July 19, 2015 Posted July 19, 2015 Hi! I have a problem, this code won't work function respawnDeadPlayer() setPedAnimation(source, CRACK, crckdeth1, 9000, true) outputChatBox("Vous êtes mort, vous allez respawn..") fadeCamera(source, false, 7) setTimer(respawnPlayerAfterDied, 10000, 1) end addEventHandler("onPlayerWasted", getRootElement(), respawnDeadPlayer) function respawnPlayerAfterDied() local p = source spawnPlayer(p, 1173.197265625, -1323.5419921875, 15.395062446594) fadeCamera(p, true, 5) outputChatBox("Vous avez respawn, bon jeu!") end It's a server side script, the console return me: "script.lua:11: Bad argument spawnplayer [expected player at argument 1, got nill]" same for 12. I tried with "player", "source" but it don't work The function respawnDeadPlayer work except the line 2, it doesn't return error in the console. I have a question: How can I turn on/off a command? Like "/airbrake" to activate and /airbrake to desactivate, I think I can do this with a boolean value (true/false) but I don't know how exactly. Sorry for my bad english, i hope you understand that and you can help me Computer science student at { EPITECH }
Walid Posted July 19, 2015 Posted July 19, 2015 it should be like this function respawnDeadPlayer() setPedAnimation(source, CRACK, crckdeth1, 9000, true) outputChatBox("Vous êtes mort, vous allez respawn..",source,255,0,0) fadeCamera(source, false, 7) setTimer(respawnPlayerAfterDied, 10000, 1,source) end addEventHandler("onPlayerWasted", root, respawnDeadPlayer) function respawnPlayerAfterDied(p) spawnPlayer(p, 1173.197265625, -1323.5419921875, 15.395062446594) fadeCamera(p, true, 5) outputChatBox("Vous avez respawn, bon jeu!",p,255,0,0) end Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
Wumbaloo Posted July 19, 2015 Author Posted July 19, 2015 Thanks, I have a question: How can I turn on/off a command? Like "/airbrake" to activate and /airbrake to desactivate, I think I can do this with a boolean value (true/false) but I don't know how exactly. Computer science student at { EPITECH }
GTX Posted July 19, 2015 Posted July 19, 2015 Like this: local state = false addCommandHandler("airbrake", function(player, command) state = not state if state == true then outputChatBox"Airbrake on" elseif state == false then outputChatBox"Airbrake off" end end ) Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
Wumbaloo Posted July 19, 2015 Author Posted July 19, 2015 Thanks! Computer science student at { EPITECH }
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