Jump to content

bosslorenz

Members
  • Posts

    200
  • Joined

  • Last visited

Posts posted by bosslorenz

  1. 1 hour ago, Dimos7 said:
    
    local gate = createObject ( 8378,1064.3000488281,1771,19.700000762939,0,0,0 ) 
    local state = 0      
      
    function move(thePlayer) 
        if getElementData(thePlayer, "group") == "Your group name here" then
           if state == 0 then  
               moveObject ( gate,4000,1064.3000488281,1771.0999755859,40.099998474121) 
               state = state + 1 
           elseif state == 1 then   
               moveObject ( gate, 4000,1064.3000488281,1771,19.700000762939) 
               state = state - 1 
           end
        end
    end 
     addCommandHandler("gate", move ) 
    

     

    How can we even make the script work for you, tell us if your group system have export functions. If yes, then put it here.

  2. function onCrimKill (ammo, attacker, weapon, bodypart) 
        local police = getTeamFromName("Police Officer") 
        local crim = getTeamFromName("Criminals") 
        local criminal = getPlayerWantedLevel(source) 
        if ( getElementType (attacker) == "player" ) then 
        if getPlayerTeam(attacker) == "police" and getPlayerTeam(source) == "crim" then 
                if criminal > 0 then 
                outputChatBox("You are arrested",source,255,0,0) 
                outputChatBox("You earned money killing a wanted person",attacker,255,0,0) 
                return end 
                outputChatBox("Police mistaken, killed you unwanted",source,255,0,0) 
        elseif getPlayerTeam(attacker) ~= "police" and getPlayerTeam(source) == "crim" then 
            outputChatBox("You are not permitted to kill a criminal",attacker,255,0,0) 
        elseif getPlayerTeam(attacker) == "police" and getPlayerTeam(source) ~= "crim" then  
            outputChatBox("You cant killed a non-criminal player",attacker,255,0,0) 
        else 
    end 
    end 
    end  
    addEventHandler("onPlayerWasted", getRootElement(), onCrimKill) 
      
    

    I have made another to check

    attacker = team and playerWasted = team  
    

    1) Doesnt return outputChatBox when doing all option.

    2) Also if attacker and playerWasted both are non of those teams the end.

    Can someone help?

  3. function onCrimKill (ammo, attacker, weapon, bodypart) 
        local police = getTeamFromName("Police Officer") 
        local criminal = getPlayerWantedLevel(source) 
        if ( getElementType (attacker) == "player" ) then 
        if (attacker) then 
            if attacker == police then 
                if criminal > 0 then 
                outputChatBox("You are arrested",source,255,0,0) 
                return end 
                outputChatBox("Police mistaken, killed you unwanted",source,255,0,0) 
            else 
            outputChatBox("You are not permitted to kill a criminal",attacker,255,0,0) 
        end 
    elseif not attacker then 
            outputChatBox(getPlayerName ( source ).."died from environment") 
            end 
        end 
    end 
    end 
    addEventHandler("onPlayerWasted", getRootElement(), onCrimKill) 
      
      
    

    Have tried this also, no errors. Tried;

    being police and killed crim(unwanted) = You are not permitted to kill a criminal

    being police and killed crim(wanted) = You are not permitted to kill a criminal

    being non-police and killer crim(wanted) & crim(unwanted) = You are not permitted to kill a criminal

  4. [2016-08-02 18:56:19] SCRIPT ERROR: PH\(PH)PoliceJob\police_arrest.lua:13: 'end' expected (to close 'if' at line 6) near 'elseif'

    [2016-08-02 18:56:19] ERROR: Loading script failed: PH\(PH)PoliceJob\police_arrest.lua:13: 'end' expected (to close 'if' at line 6) near 'elseif'

    function onCrimKill (ammo, attacker, weapon, bodypart) 
        local police = getTeamFromName("Police Officer") 
        local criminal = getElementType(source) 
        if ( getElementType (attacker) == "player" ) then 
        if (attacker) then 
            if attacker == police then 
                if criminal > 0 then 
                outputChatBox("You are arrested",source,255,0,0) 
                return end 
                outputChatBox("Police mistaken, killed you unwanted",source,255,0,0) 
            else 
            outputChatBox("You are not permitted to kill a criminal",attacker,255,0,0) 
        elseif not attacker then 
            outputChatBox(getPlayerName ( source ).."died from environment") 
            end 
        end 
    end 
    end 
    addEventHandler("onPlayerWasted", getRootElement(), onCrimKill) 
      
      
    

    I have attacker == police then. Then I want to check the wantedLevel of the wasted crim.

    If crim has > 0 WL then arrest elseif the crim not wanted then output to crim (You are mistaken killed by a police).

    Else if attacker of crim is not on police team then output to Killer (You cant kill crim)

    while if there is no attacker then output all (Player(killed) getName is killed through environment hazards.

    I dont know have much scripting knowledge if the (IF argument gets higher than 2 ) :/ Someone help me?

  5. function startBR() 
    brEnt = createMarker(1570.2,-1337.7,17,"arrow",1,0,255,0,255) 
    outputChatBox("Bank is now open, you can rob it for 1 minute") 
    setTimer(destroyElement,60000,1,brEnt) 
    end 
    addCommandHandler("br",startBR) 
    

    So I have made this marker (entrance to bank rob), and disappears after 1 minute.

    1) But what eventHandler should I use for it to start the function as soon as the server starts?

  6. setTimer(function() 
    marker1 = createMarker(1201,-1340,12.2,"cylinder",2,255,0,0,255) 
    end,30000,0) 
    

    Here I made this but the other function

    addEventHandler("onMarkerHit",marker1,bankRobStart) 
    

    Error expected element on argument 2, got nil. Since I made the marker inside the setTimer function. the marker1 on argument 2 cant be called.

  7. marker1 = createMarker(1201,-1340,12.2,"cylinder",2,255,0,0,255) 
    function bankRobStart(player) 
        local getPTeam = getTeamFromName("Criminals") 
        local playerTeam = getPlayerTeam(player) 
        if playerTeam == getPTeam then 
            if getElementType(player) == "player" then 
            outputChatBox("Stay on the marker for 5 seconds to finish bank robbing", player, 255,0,0) 
            theTime = setTimer (function() 
            givePlayerMoney(player, 50) 
            end, 5000, 0) 
            end 
        else 
            outputChatBox("You are not criminal", player, 255, 0, 0) 
        end 
    end 
    addEventHandler("onMarkerHit",marker1,bankRobStart) 
      
    function killTime() 
        if isTimer(theTime) then 
            killTimer(theTime) 
        end 
    end 
    addEventHandler("onMarkerLeave", marker1, killTime) 
    addEventHandler("onPlayerQuit", getRootElement(), killTime) 
    addEventHandler("onPlayerWasted", getRootElement(), killTime) 
    

    Example marker1.

    Available for 10minutes. After that it gets destroy. Again, after 20 minutes from destruction. It spawns again for 10minutes. Need some help here.

  8. Is it possible to create an inventory system for Roleplay with just guiWindow? And then the items on gridlist.

    Example Gridlist has two Columns.

    1) Item name and 2) Item pieces.

    Well the Item names are like constant. All I want is that when I make a setElementData, it will change the text on (item pieces)

  9.  if getElementType ( vehController ) == "player" then  
    

    Why change this to vehController, then this will definitely not work on anymore when I am on feet walking into the marker.

    vehController is the player, it must work lol

    It must work lol? It doesnt even help me, your codes gives more error in fact, I didn't even said I had error in my line

    hitElement = getVehicleController ( hitElement ); 
    

    What I ask is that in getElementType (hitElement) =="player" it returns error of peds so the problem is only on (hitElement)=="ped" . :roll::roll:

  10.  if getElementType ( vehController ) == "player" then  
    

    Why change this to vehController, then this will definitely not work on anymore when I am on feet walking into the marker.

    vehController is the player, it must work lol

    As If I didn't tried your code. Your code gives more error. The moveObject doesnt even work anymore. BTW, I just managed to make it work by putting this on first line of every function.

        if getElementType( hitElement ) == "ped" then return end 
    

  11.  if getElementType ( vehController ) == "player" then  
    

    Why change this to vehController, then this will definitely not work on anymore when I am on feet walking into the marker.

  12. function movingObject ( hitElement, matchingDimension ) 
        if ( getElementType ( hitElement ) == "vehicle" ) then 
        hitElement = getVehicleController ( hitElement ); 
        if ( not hitElement ) then 
            return false; 
        end 
    end 
        local gPT = getPlayerTeam ( hitElement ) 
        local gTN = ( gPT and getTeamName ( gPT ) or "" ) 
        if gTN =="Los Santos Civilians" then 
            if getElementType ( hitElement ) == "player" then 
            moveObject ( gate1, 10000, 1201, -1384.5, 9.3 ) 
        end 
    end 
    end 
      
    function moveObjectBack (hitElement, matchingDimension) 
        if ( getElementType ( hitElement ) == "vehicle" ) then 
        hitElement = getVehicleController ( hitElement ); 
        if ( not hitElement ) then 
            return false; 
        end 
    end 
        local gPT = getPlayerTeam ( hitElement ) 
        local gTN = ( gPT and getTeamName ( gPT ) or "" ) 
        if gTN =="Los Santos Civilians" then 
        if getElementType ( hitElement ) == "player" then 
            moveObject ( gate1, 3000, 1201, -1384.5, 15.1 ) 
        end 
    end 
    end 
      
    addEventHandler ( "onMarkerHit", marker1 , movingObject ) 
    addEventHandler ( "onMarkerLeave", marker1, moveObjectBack ) 
    

    Problem is that when a ped enters the marker it gives error, since I am using slothman zombies.

    lua:21: Bad argument @ 'getPlayerTeam' [Expected player at argument 1, got marker] 
    lua:37: Bad argument @ 'getPlayerTeam' [Expected player at argument 1, got marker] 
    lua:59: Bad argument @ 'getPlayerTeam' [Expected player at argument 1, got marker] 
    lua:75: Bad argument @ 'getPlayerTeam' [Expected player at argument 1, got marker] 
      
    

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

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

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

  16.   
    function createGMTEAM(source) 
    ex = createTeam("GM TEAM") 
    setPlayerTeam(source,ex) 
    end 
    addCommandHandler("gm",createGMTEAM) 
      
    

    You should type /gm on *T* chat and this will create a GM TEAM and automatically puts you in that team.

    Other is like

      
    ex = createTeam("GM TEAM") 
    function makemeGM(source) 
    setPlayerTeam(source,ex) 
    end 
    addCommandHandler("gm",makemeGM) 
      
    

    2nd script the GM TEAM is already created and you just have to type /gm in *T* chat to get you on that team.

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

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

×
×
  • Create New...