Jump to content

Unemploy script [HELP]


Sande

Recommended Posts

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

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 by Guest
Link to comment

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

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
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
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

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
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

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 by Guest
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...