Sande Posted July 16, 2013 Share Posted July 16, 2013 Hey, i started to make unemploy script, but i am so shit and i dont know why this not working.. can someone do this finish? function unemploy ( thePlayer ) local wlevel = getPlayerWantedLevel( thePlayer ) if wlevel > 6 then --[[ 6 stars --]] theTeam = getPlayerTeam ( thePlayer ) if getTeamName( theTeam ) == "Police" or getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "FBI" or getTeamName( theTeam ) == "Army" then setPlayerTeam(thePlayer,getTeamFromName("Unemployed")) then outputChatBox ("Menetit työsi, koska olet korruptoitunut!, 255, 0, 0, thePlayer ) end --[[ Event ?!?, idk what do next --]] Link to comment
فاّرس Posted July 16, 2013 Share Posted July 16, 2013 (edited) Edit # : Try that now. function() local wlevel = getPlayerWantedLevel(source) if wlevel > 6 then theTeam = getPlayerTeam (source) if theTeam and getTeamName( theTeam ) == "Police" or getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "FBI" or getTeamName( theTeam ) == "Army" then setPlayerTeam(source,getTeamFromName("Unemployed")) outputChatBox ("Menetit työsi, koska olet korruptoitunut!",source, 255, 0, 0,true ) end end end If you want add event : change ( source ) to the define event. Edited July 16, 2013 by Guest Link to comment
Sande Posted July 16, 2013 Author Share Posted July 16, 2013 Something is wrong online 6 near ) then ( Link to comment
iMr.3a[Z]eF Posted July 16, 2013 Share Posted July 16, 2013 try function() local wlevel = getPlayerWantedLevel(source) if wlevel > 6 then theTeam = getPlayerTeam (source) if theTeam and getTeamName( theTeam ) == "Police" or getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "FBI" or getTeamName( theTeam ) == "Army" then setPlayerTeam(source,getTeamFromName("Unemployed")) outputChatBox ("Menetit työsi, koska olet korruptoitunut!",source, 255, 0, 0,true ) end end end Link to comment
Sande Posted July 16, 2013 Author Share Posted July 16, 2013 No errors, but not working. Need some event but what event? Link to comment
فاّرس Posted July 17, 2013 Share Posted July 17, 2013 No errors, but not working. Need some event but what event? What do want to do ? Link to comment
iMr.3a[Z]eF Posted July 17, 2013 Share Posted July 17, 2013 What do you want from this functions to do?. Link to comment
codeluaeveryday Posted July 17, 2013 Share Posted July 17, 2013 Hey man, sorry that all these other scripters didn't know how to help you. Tell me if there's an error. function unemploy ( thePlayer ) local wlevel = getPlayerWantedLevel( thePlayer ) if wlevel < 6 then -- Changed from > to < local theTeam = getPlayerTeam ( thePlayer ) local teamName = getTeamName ( theTeam ) if teamName == "Police" or teamName == "SWAT" or teamName == "FBI" or teamName == "Army" then setPlayerTeam(thePlayer, getTeamFromName("Unemployed")) outputChatBox ("Menetit työsi koska olet korruptoitunut!", thePlayer, 255, 0, 0) end end end addCommandHandler('unemploy', unemploy) Link to comment
فاّرس Posted July 17, 2013 Share Posted July 17, 2013 Hey man, sorry that all these other scripters didn't know how to help you.Tell me if there's an error. function unemploy ( thePlayer ) local wlevel = getPlayerWantedLevel( thePlayer ) if wlevel < 6 then -- Changed from > to < local theTeam = getPlayerTeam ( thePlayer ) local teamName = getTeamName ( theTeam ) if teamName == "Police" or teamName == "SWAT" or teamName == "FBI" or teamName == "Army" then setPlayerTeam(thePlayer, getTeamFromName("Unemployed")) outputChatBox ("Menetit työsi koska olet korruptoitunut!", thePlayer, 255, 0, 0) end end end addCommandHandler('unemploy', unemploy) He's not said what he want Link to comment
codeluaeveryday Posted July 17, 2013 Share Posted July 17, 2013 He's not said what he want You guys didn't read what he wanted, learn English before attempting to read it. You guys failed at helping him, now please don't make this a rage war, it's a simple code. Link to comment
myonlake Posted July 17, 2013 Share Posted July 17, 2013 He's not said what he want There are mistakes in the code and unless you can see them you shouldn't be helping around if you're not sure what he wanted. As far as I can tell, csmit's code should work, ignore the other snippets since they don't even have a function name defined and could be a lot simpler. Link to comment
Sande Posted July 17, 2013 Author Share Posted July 17, 2013 The point in this script is if police get six wanted they going to unemployed. But how to make like that? All codes posted on what have not been such. Link to comment
Jaysds1 Posted July 19, 2013 Share Posted July 19, 2013 Not sure if this is what you wanted: Server-side local govTeams = { ["Police"]=true, ["SWAT"]=true, ["FBI"]=true, ["Army"]=true } function unemploy ( thePlayer ) if getPlayerWantedLevel( thePlayer ) == 6 and then --check if the players wanted level is 6 if govTeams[getTeamName(getPlayerTeam(thePlayer))] then --check if the player is working for the government setPlayerTeam(thePlayer,getTeamFromName("Unemployed")) --set the player to un-employed as the government doesn't like criminals outputChatBox ("Menetit työsi, koska olet korruptoitunut!", 255, 0, 0, thePlayer ) end end end addEventHandler("onPlayerWasted",root,unemploy) --This is triggered when a player dies Link to comment
Baseplate Posted July 19, 2013 Share Posted July 19, 2013 @The Best, 3azef if wlevel > 6 then Seriously? how did it become that you can have MORE than 6 stars anyways? Link to comment
Jaysds1 Posted July 19, 2013 Share Posted July 19, 2013 Lol, I've seen that and I had to shake my head, anyways, wait till @Sandelssi13 replies!!! Link to comment
codeluaeveryday Posted July 19, 2013 Share Posted July 19, 2013 I saw it too, it's why my code actually changed it. I literally learn't that in grade 6 maths. Link to comment
Sande Posted July 19, 2013 Author Share Posted July 19, 2013 Not sure if this is what you wanted:Server-side local govTeams = { ["Police"]=true, ["SWAT"]=true, ["FBI"]=true, ["Army"]=true } function unemploy ( thePlayer ) if getPlayerWantedLevel( thePlayer ) == 6 and then --check if the players wanted level is 6 if govTeams[getTeamName(getPlayerTeam(thePlayer))] then --check if the player is working for the government setPlayerTeam(thePlayer,getTeamFromName("Unemployed")) --set the player to un-employed as the government doesn't like criminals outputChatBox ("Menetit työsi, koska olet korruptoitunut!", 255, 0, 0, thePlayer ) end end end addEventHandler("onPlayerWasted",root,unemploy) --This is triggered when a player dies Thats good, but when i die nothing happens if im Army, Police and 6 stars. Link to comment
Jaysds1 Posted July 19, 2013 Share Posted July 19, 2013 (edited) Sorry, I used the wrong event, try this one: local govTeams = { ["Police"]=true, ["SWAT"]=true, ["FBI"]=true, ["Army"]=true } function unemploy ( thePlayer ) if getElementType(thePlayer)~="player" then return end if getPlayerWantedLevel( thePlayer ) == 6 and then --check if the players wanted level is 6 if govTeams[getTeamName(getPlayerTeam(thePlayer))] then --check if the player is working for the government setPlayerTeam(thePlayer,getTeamFromName("Unemployed")) --set the player to un-employed as the government doesn't like criminals outputChatBox ("Menetit työsi, koska olet korruptoitunut!",thePlayer , 255, 0, 0) end end end addEventHandler("onPlayerDamage",root,unemploy) --This is triggered when a player is attacked Edited July 19, 2013 by Guest Link to comment
Sande Posted July 19, 2013 Author Share Posted July 19, 2013 Working, but message not shows when you got unemployed. Link to comment
Jaysds1 Posted July 19, 2013 Share Posted July 19, 2013 Edited the script again, the problem was that the element "player" was at the end of the outputChatBox parameter. Link to comment
Sande Posted July 19, 2013 Author Share Posted July 19, 2013 Edited the script again,the problem was that the element "player" was at the end of the outputChatBox parameter. WORKING! Thank you 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