Jump to content

jail error


Monty

Recommended Posts

Posted

why i don't get unjailed after 10 sec?

function policeJob ( attacker, attackerweapon, bodypart, loss ) 
    theTeam = getPlayerTeam ( attacker )  
    theWL = getPlayerWantedLevel ( source ) 
    theSkin = getElementModel ( attacker )  
    if (attackerweapon == 3) and (loss > 2 ) and (theWL > 0) then 
    if ( getTeamName( theTeam ) == "police" ) or ( ( getTeamName( theTeam ) == "SWAT" ) )  or ( ( getTeamName( theTeam ) == "FBI" ) )then 
        setElementPosition (source, 4076.3999023438, -1788.5, 3.511967, true) 
    theName = getPlayerName ( source ) 
  theCop = getPlayerName ( attacker )    
    outputChatBox ( "You have been jailed by "..theCop.. " for 10 seconds.", source ) 
    local playeraccount = getPlayerAccount ( attacker ) 
    arrests = getAccountData(playeraccount, "arrest") 
      setAccountData(playeraccount, "arrest", arrests + 1 ) 
        givePlayerMoney (attacker, 100) 
setTimer ( setElementPosition, 10000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439)         
setPlayerWantedLevel (source, 0) 
        end 
  end 
end 
addEventHandler ("onPlayerDamage", getRootElement(), policeJob) 

  • MTA Team
Posted
  
function KillPeopleWhoDontTabulateOrIndent() 
    for i, v in ipairs(getElementsByType"player") do 
        while true do 
            if getElementData(v, "indenter") then break end 
            killPed(v) 
            outputChatBox("You suck1!11111!!!!", v) 
            if getElementData(v, "retarded") == true then 
                kickPlayer(v) 
            end 
            break 
        end 
     end 
end 
addCommandHandler("retard", function() 
        KillPeopleWhoDontTabulateOrIndent() 
    end 
) 

SPACES!

Also use Locals

Posted
createBlip ( 1552.4996337891, -1677.3264160156, 15.1953125, 30 ) 
  
function createSAPDTeam () 
    SAPDteam = createTeam ("police", 100, 149, 237) 
end 
addEventHandler ("onResourceStart", resourceRoot, createSAPDTeam) 
  
function joinSAPD() 
     setPlayerTeam(source,SAPDteam) 
     setElementModel(source, 280) 
      giveWeapon ( source, 3 ) 
     setAccountData( playeraccount, "Occupation", "police") 
     outputChatBox("You are now policeman.",source,0,255,0) 
end 
addEvent("setSAPD", true) 
addEventHandler("setSAPD",root,joinSAPD) 
  
function policeJob ( attacker, attackerweapon, bodypart, loss ) 
    theTeam = getPlayerTeam ( attacker )  
    theWL = getPlayerWantedLevel ( source ) 
    theSkin = getElementModel ( attacker )  
    if (attackerweapon == 3) and (loss > 2 ) and (theWL > 0) then 
    if ( getTeamName( theTeam ) == "police" ) or ( ( getTeamName( theTeam ) == "SWAT" ) )  or ( ( getTeamName( theTeam ) == "FBI" ) )then 
        setElementPosition (source, 4076.3999023438, -1788.5, 3.511967, true) 
    theName = getPlayerName ( source ) 
  theCop = getPlayerName ( attacker )    
    outputChatBox ( "You have been jailed by "..theCop.. " for 10 seconds.", source ) 
    local playeraccount = getPlayerAccount ( attacker ) 
    arrests = getAccountData(playeraccount, "arrest") 
      setAccountData(playeraccount, "arrest", arrests + 1 ) 
        givePlayerMoney (attacker, 100) 
setTimer ( setElementPosition, 10000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439)         
setPlayerWantedLevel (source, 0) 
        end 
  end 
end 
addEventHandler ("onPlayerDamage", getRootElement(), policeJob) 

Posted
... i dont understand the code you have made without proper indentation/tabulation

you can make it by yourself

createBlip ( 1552.4996337891, -1677.3264160156, 15.1953125, 30 ) 
  
function createSAPDTeam () 
    SAPDteam = createTeam ("police", 100, 149, 237) 
end 
addEventHandler ("onResourceStart", resourceRoot, createSAPDTeam) 
  
function joinSAPD() 
    setPlayerTeam(source,SAPDteam) 
    setElementModel(source, 280) 
    giveWeapon ( source, 3 ) 
    setAccountData( playeraccount, "Occupation", "police") 
    outputChatBox("You are now policeman.",source,0,255,0) 
end 
addEvent("setSAPD", true) 
addEventHandler("setSAPD",root,joinSAPD) 
  
function policeJob ( attacker, attackerweapon, bodypart, loss ) 
    theTeam = getPlayerTeam ( attacker ) 
    theWL = getPlayerWantedLevel ( source ) 
    theSkin = getElementModel ( attacker ) 
    if (attackerweapon == 3) and (loss > 2 ) and (theWL > 0) then 
        if  getTeamName( theTeam ) == "police" or getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "FBI" then 
            setElementPosition (source, 4076.3999023438, -1788.5, 3.511967, true) 
            theName = getPlayerName ( source ) 
            theCop = getPlayerName ( attacker )    
            outputChatBox ( "You have been jailed by "..theCop.. " for 10 seconds.", source ) 
            local playeraccount = getPlayerAccount ( attacker ) 
            arrests = getAccountData(playeraccount, "arrest") 
            setAccountData(playeraccount, "arrest", arrests + 1 ) 
            givePlayerMoney (attacker, 100) 
            setTimer ( setElementPosition, 10000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439)        
            setPlayerWantedLevel (source, 0) 
        end 
    end 
end 
addEventHandler ("onPlayerDamage", getRootElement(), policeJob) 

  • MTA Team
Posted

It's his job to make it easier for himself and everyone else. We shouldn't do the dirty work, he should.

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