bosslorenz Posted July 27, 2016 Share Posted July 27, 2016 civilian = createTeam("Civilian Workers",255,255,0) function Civilian (source) local civteam = getTeamFromName("Civilian Workers") local playerTeam = getPlayerTeam ( source ) local wantedLevel = getPlayerWantedLevel (source) if playerTeam == civteam then outputChatBox("You are already on Civilian team",source,255,0,0) return end if wantedLevel == 0 then veh = isPedInVehicle(source) if (veh) then outputChatBox("You are on vehicle",source,255,0,0) return end outputChatBox("You are now a Civilian",source,0,255,0) setPlayerTeam(source,civilian) elseif wantedLevel > 0 then outputChatBox("You are wanted",source,255,0,0) end end addCommandHandler("civilian",Civilian) What did I miss here? I have command /civilian. The problem is that all the option I tried using /civilian when wanted, inside a car or just on the ground. It gives only one output the You are wanted Link to comment
Hale Posted July 27, 2016 Share Posted July 27, 2016 What did I miss here? I have command /civilian. The problem is that all the option I tried using /civilian when wanted, inside a car or just on the ground. It gives only one output the You are wanted local wantedLevel = getPlayerWantedLevel (source) if playerTeam == civteam then outputChatBox("You are already on Civilian team",source,255,0,0) return end if wantedLevel == 0 then veh = isPedInVehicle(source) if (veh) then outputChatBox("You are on vehicle",source,255,0,0) return end outputChatBox("You are now a Civilian",source,0,255,0) setPlayerTeam(source,civilian) elseif wantedLevel > 0 then outputChatBox("You are wanted",source,255,0,0) end end addCommandHandler("civilian",Civilian) Link to comment
bosslorenz Posted July 27, 2016 Author Share Posted July 27, 2016 What did I miss here? I have command /civilian. The problem is that all the option I tried using /civilian when wanted, inside a car or just on the ground. It gives only one output the You are wanted local wantedLevel = getPlayerWantedLevel (source) if playerTeam == civteam then outputChatBox("You are already on Civilian team",source,255,0,0) return end if wantedLevel == 0 then veh = isPedInVehicle(source) if (veh) then outputChatBox("You are on vehicle",source,255,0,0) return end outputChatBox("You are now a Civilian",source,0,255,0) setPlayerTeam(source,civilian) elseif wantedLevel > 0 then outputChatBox("You are wanted",source,255,0,0) end end addCommandHandler("civilian",Civilian) Please dont event reply if you are not going to change something. Link to comment
Hale Posted July 27, 2016 Share Posted July 27, 2016 Buddy, how can I change something when there is no need for change? I highlighted what you wrote, you said you tried the command while you were wanted, that's why it always outputs "You are wanted". Link to comment
bosslorenz Posted July 27, 2016 Author Share Posted July 27, 2016 Maybe I just missed a comma(,) what I said I tried all that option (when wanted, inside a car and just on the ground) and just outputs one!. Link to comment
Hale Posted July 27, 2016 Share Posted July 27, 2016 Did you try it when you were not wanted? Link to comment
bosslorenz Posted July 27, 2016 Author Share Posted July 27, 2016 Did you try it when you were not wanted? YES Link to comment
Hale Posted July 27, 2016 Share Posted July 27, 2016 Try this: civilian = createTeam("Civilian Workers",255,255,0) function Civilian (source) local civteam = getTeamFromName("Civilian Workers") local playerTeam = getPlayerTeam ( source ) setPlayerWantedLevel(source, 0) local wantedLevel = getPlayerWantedLevel (source) if playerTeam == civteam then outputChatBox("You are already on Civilian team",source,255,0,0) return end if wantedLevel == 0 then veh = isPedInVehicle(source) if (veh) then outputChatBox("You are on vehicle",source,255,0,0) return end outputChatBox("You are now a Civilian",source,0,255,0) setPlayerTeam(source,civilian) elseif wantedLevel > 0 then outputChatBox("You are wanted",source,255,0,0) end end addCommandHandler("civilian",Civilian) Tell me if it still outputs the same. Also, are you getting any errors in the debug? Link to comment
bosslorenz Posted July 27, 2016 Author Share Posted July 27, 2016 WTF? why are you setting the WantedLevel of the one who execute the command to 0? really? setPlayerWantedLevel(source, 0) Link to comment
Hale Posted July 27, 2016 Share Posted July 27, 2016 You obviously don't know how to check if your code is legit and working, and if you're not cooperative I'm not going to bother helping you. Good luck with the code. Link to comment
bosslorenz Posted July 27, 2016 Author Share Posted July 27, 2016 You dont event know what you are doing too. I am just asking my error why does it return only one (You are wanted) yet you are adding non sense codes like that setting the wantedlevel of the player. Link to comment
bosslorenz Posted July 27, 2016 Author Share Posted July 27, 2016 I have changed the codes and now I only get one error now. civilian = createTeam("Civilian Workers",255,255,0) function Civilian (source) civteam = getTeamFromName("Civilian Workers") playerTeam = getPlayerTeam(source) wantedLevel = getPlayerWantedLevel (source) veh = isPedInVehicle(source) if not (playerTeam == civteam) then if wantedLevel == 0 then if (veh) then outputChatBox("You are on vehicle",source,255,0,0) else outputChatBox("You are now a Civilian",source,0,255,0) setPlayerTeam(source,civilian) end elseif wantedLevel > 0 then outputChatBox("You are wanted",source,255,0,0) end else outputChatBox("You are already in Civilian Team",source,255,0,0) end end addCommandHandler("civilian",Civilian) You are now a Civilian and You are already in Civilian Team is now working But when I am on a vehicle and not wanted. It gives me this, You are wanted Link to comment
Walid Posted July 27, 2016 Share Posted July 27, 2016 local civilian = createTeam("Civilian Workers",255,255,0) function Civilian (player) local playerTeam = getPlayerTeam(player) local wantedLevel = getPlayerWantedLevel (player) or 0 if not (playerTeam == civilian) then if wantedLevel == 0 then if isPedInVehicle(player) then outputChatBox("You can't use this command when inside a vehicle",player,255,0,0) return end outputChatBox("You are now a Civilian",player,0,255,0) setPlayerTeam(player,civilian) else outputChatBox("You are wanted",player,255,0,0) end else outputChatBox("You are already in Civilian Team",player,255,0,0) end end addCommandHandler("civilian",Civilian) Link to comment
bosslorenz Posted July 27, 2016 Author Share Posted July 27, 2016 local civilian = createTeam("Civilian Workers",255,255,0) function Civilian (player) local playerTeam = getPlayerTeam(player) local wantedLevel = getPlayerWantedLevel (player) or 0 if not (playerTeam == civilian) then if wantedLevel == 0 then if isPedInVehicle(player) then outputChatBox("You can't use this command when inside a vehicle",player,255,0,0) return end outputChatBox("You are now a Civilian",player,0,255,0) setPlayerTeam(player,civilian) else outputChatBox("You are wanted",player,255,0,0) end else outputChatBox("You are already in Civilian Team",player,255,0,0) end end addCommandHandler("civilian",Civilian) Now all option became (You are wanted) Link to comment
Captain Cody Posted July 27, 2016 Share Posted July 27, 2016 You're insane then, unless you have a wanted level that should not appear, I checked every bit of this code for what would be causing it, nothing. Link to comment
bosslorenz Posted July 27, 2016 Author Share Posted July 27, 2016 civilian = createTeam("Civilian Workers",255,255,0) function Civilian (source) civteam = getTeamFromName("Civilian Workers") playerTeam = getPlayerTeam(source) wantedLevel = getPlayerWantedLevel (source) veh = isPedInVehicle(source) if not (playerTeam == civteam) then if wantedLevel == 0 then if (veh) then outputChatBox("You are on vehicle",source,255,0,0) else outputChatBox("You are now a Civilian",source,0,255,0) setPlayerTeam(source,civilian) end elseif wantedLevel > 0 then outputChatBox("You are wanted",source,255,0,0) end else outputChatBox("You are already in Civilian Team",source,255,0,0) end end addCommandHandler("civilian",Civilian) Is like If team is not Civilian Workers >if wanted = 0 > if on vehicle > output(In vehicle) >if wanted = 0 > if not on vehicle > output(You are now Civ) >if wanted > 0 > if on vehicle/ not on vehicle > You are wanted. Else If on Civilian >output (You are already Civs.) My script is working if not wanted it makes me Civilian and when trying to execute it again also work (You are already Civ.) the problem is that If I get on vehicle and not wanted, it shows me (You are wanted) rather than (You are in vehicle). Link to comment
Hale Posted July 27, 2016 Share Posted July 27, 2016 You're insane then, unless you have a wanted level that should not appear, I checked every bit of this code for what would be causing it, nothing. Thank you, Jesus... Link to comment
bosslorenz Posted July 27, 2016 Author Share Posted July 27, 2016 You're insane then, unless you have a wanted level that should not appear, I checked every bit of this code for what would be causing it, nothing. Thank you, Jesus... Adding the script with setPlayerWanteLevel to 0 even if not asked to. That is why I have the *IF* argument of wantedLevel ==0 and wantedLevel > 0. Jesus ! 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