Jump to content

Police Salary


Estevam2d

Recommended Posts

Posted

I start the script nothing happens, I do not know what the error is.

Help-me, sorry bad english.

addEventHandler("onResourceStart", resourceRoot, function() 
    setTimer(function(source) 
    if getPlayerTeam(source) == getTeamFromName("Policia Militar Oficial") then 
       givePlayerMoney ( source, 1 ) 
         outputChatBox ( "#00B3FFSalario recebido foi de #00FF2A$#F6FF001 (teste)", source, 10, 118, 240, true) 
        end 
    end, 1000, 0, source ) 
end 
) 

Posted
  
addEventHandler("onResourceStart", resourceRoot, function() 
    setTimer(function() 
    for k,source in ipairs(getElementsByType("player")) do 
        if getTeamName(getPlayerTeam(source)) == getTeamFromName("Policia Militar Oficial") then 
            givePlayerMoney ( source, 1 ) 
            outputChatBox ( "#00B3FFSalario recebido foi de #00FF2A$#F6FF001 (teste)", source, 10, 118, 240, true) 
            end 
        end 
    end, 1000, 0) 
end 
) 
  

Posted

I'm doing a new method.

New:

function desapar(player) 
    if getPlayerTeam(player) == getTeamFromName("Policia Militar Oficial") then 
    outputChatBox ( "#00B3FFSalario recebido foi de #00FF2A$#F6FF009000 (teste)", player, 10, 118, 240, true) 
    end 
end 
addEventHandler("onResourceStart",getRootElement(),desapar) 
  

how to script with start onResourceStart ?

With this:

addEventHandler("onResourceStart", resourceRoot, onCurrentResourceStart) 

?

Posted
  
function desapar(player) 
    if getPlayerTeam(player) == getTeamFromName("Policia Militar Oficial") then 
    outputChatBox ( "#00B3FFSalario recebido foi de #00FF2A$#F6FF009000 (teste)", player, 10, 118, 240, true) 
    end 
end 
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),desapar) 
  
  

Posted
  
function desapar(player) 
    if getPlayerTeam(player) == getTeamFromName("Policia Militar Oficial") then 
    outputChatBox ( "#00B3FFSalario recebido foi de #00FF2A$#F6FF009000 (teste)", player, 10, 118, 240, true) 
    end 
end 
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),desapar) 
  
  

onResourceStart has no 'player' parameter. Actually, the first parameter is the started resource.

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

Ty for reminding @ DNL

  
function desapar() 
    for k,player in ipairs(getElementsByType("player")) do 
    if getPlayerTeam(player) == getTeamFromName("Policia Militar Oficial") then 
    outputChatBox ( "#00B3FFSalario recebido foi de #00FF2A$#F6FF009000 (teste)", player, 10, 118, 240, true) 
           end 
     end 
end 
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),desapar) 
  

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