Jump to content

Need more help


Baseplate

Recommended Posts

Well alright, this is my current script

Server.lua:

function joinMedic() 
     setPlayerTeam(source, getTeamFromName("Military")) 
     setElementModel(source,293) 
     setElementData(source, "Occupation", "Military", true) 
     outputChatBox("You are now Military.",source,0,255,0) 
end 
addEvent("setMili", true) 
addEventHandler("setMili",root,joinMedic) 

Client.lua:

local marker = createMarker(1552.33, -1605.37, 12.5, "Cylinder",2,6,183,248,153) 
  
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Label = {} 
  
local x,y = guiGetScreenSize() 
windowjob = guiCreateWindow(x/2-150,y/2-199,301,397,"Military job",false) 
guiSetVisible(windowjob, false) 
GUIEditor_Button[1] = guiCreateButton(22,352,108,35,"Take job",false,windowjob) 
GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) 
GUIEditor_Button[2] = guiCreateButton(179,352,110,36,"Cancel",false,windowjob) 
GUIEditor_Memo[1] = guiCreateMemo(19,33,273,215,"To take Military job, press Take job.\n\nIf you don't want to, press Cancel.",false,windowjob) 
  
function Medicjob(hitElement) 
     if getElementType(hitElement) == "player" and hitElement == localPlayer then 
          if not guiGetVisible(windowjob) then 
               guiSetVisible(windowjob, true) 
               showCursor(true) 
          end 
     end 
end 
addEventHandler("onClientMarkerHit", marker, Medicjob) 
  
function Medicjobleave(leaveElement) 
     if getElementType(leaveElement) == "player" and leaveElement == localPlayer then 
          if guiGetVisible(windowjob) then 
               guiSetVisible(windowjob, false) 
               showCursor(false) 
          end 
     end 
end 
addEventHandler("onClientMarkerLeave", marker, Medicjobleave) 
  
function joinTeam() 
     triggerServerEvent("setMili",localPlayer) 
     guiSetVisible(windowjob, false) 
     showCursor(false) 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) 
  
function removeMedicWindow() 
     guiSetVisible(windowjob, false) 
     showCursor(false) 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeMedicWindow, false) 

Okay, i'm using Castillo's gang system, is there anyway to set this marker for Military group only?

Link to comment
local marker = createMarker(1552.33, -1605.37, 12.5, "Cylinder",2,6,183,248,153) 
  
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Label = {} 
  
local x,y = guiGetScreenSize() 
windowjob = guiCreateWindow(x/2-150,y/2-199,301,397,"Military job",false) 
guiSetVisible(windowjob, false) 
GUIEditor_Button[1] = guiCreateButton(22,352,108,35,"Take job",false,windowjob) 
GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) 
GUIEditor_Button[2] = guiCreateButton(179,352,110,36,"Cancel",false,windowjob) 
GUIEditor_Memo[1] = guiCreateMemo(19,33,273,215,"To take Military job, press Take job.\n\nIf you don't want to, press Cancel.",false,windowjob) 
  
function Medicjob(hitElement) 
     if getElementType(hitElement) == "player" and hitElement == localPlayer then 
          if (getElementData(hitElement, "gang") == "Military") then 
               if not guiGetVisible(windowjob) then 
                    guiSetVisible(windowjob, true) 
                    showCursor(true) 
               end 
          end 
     end 
end 
addEventHandler("onClientMarkerHit", marker, Medicjob) 
  
function Medicjobleave(leaveElement) 
     if getElementType(leaveElement) == "player" and leaveElement == localPlayer then 
          if (getElementData(hitElement, "gang") == "Military") then 
               if guiGetVisible(windowjob) then 
                    guiSetVisible(windowjob, false) 
                    showCursor(false) 
               end 
          end 
     end 
end 
addEventHandler("onClientMarkerLeave", marker, Medicjobleave) 
  
function joinTeam() 
     triggerServerEvent("setMili",localPlayer) 
     guiSetVisible(windowjob, false) 
     showCursor(false) 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) 
  
function removeMedicWindow() 
     guiSetVisible(windowjob, false) 
     showCursor(false) 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeMedicWindow, false) 

Here you don't need true, it's already true by default.

setElementData(source, "Occupation", "Military", true) 

Link to comment
Sorry it's not my post but i have a question how to add carspowner when you take the job ( only medics can see them ) ?

This depends on the car spawner, it will be a marker?

You can easily make the marker visible only to medics, but again it depends on how you will get these medics, is they are team? gang? ACL group?

You can use

setElementVisibleTo 

or you can use IF statement to make the marker show the gui only for medics, whatever they were a team or gang or ACL group.

Link to comment
Sorry it's not my post but i have a question how to add carspowner when you take the job ( only medics can see them ) ?

This depends on the car spawner, it will be a marker?

You can easily make the marker visible only to medics, but again it depends on how you will get these medics, is they are team? gang? ACL group?

You can use

setElementVisibleTo 

or you can use IF statement to make the marker show the gui only for medics, whatever they were a team or gang or ACL group.

Yes rights it will be a marker when he take medic job he can see the marker( car medic spowner)

i can use this code but how to change someguy to medic team ???

local someguy = getPlayerFromName ( "someguy" ) 
if ( someguy ) then 
    x, y, z = getElementPosition ( someguy ) 
    myMarker = createMarker ( x, y, z ) 
    setElementVisibleTo ( myMarker, getRootElement ( ), false ) 
    setElementVisibleTo ( myMarker, someguy, true ) 
end 

and for hide the marker too

local someguy = getPlayerFromName ( "someguy" ) 
local anotherguy = getPlayerFromName ( "anotherguy" )  
if ( someguy ) then 
    x, y, z = getElementPosition ( someguy ) 
    myMarker = createMarker ( x, y, z ) 
    setElementVisibleTo ( myMarker, anotherguy, true ) 
    setElementVisibleTo ( myMarker, anotherguy, false ) 
end 

and if like you say i can use If is this right ?

function joinTeam() 
         triggerServerEvent("setMedic",localPlayer) 
         guiSetVisible(windowjob, false) 
         showCursor(false) 
         showMarker(true) --------like this ??----------- 
    end 

or should i add it in this function ?

    addEventHandler("onClientPlayerDamage", localPlayer, 
function(attacker, weapon, bodypart, loss) 
team = getPlayerTeam(attacker) 
    if (attacker and getElementType(attacker) == "player" and weapon == 41 and team and getTeamName(team) == "Medic") then  
        cancelEvent() -- Cancels the damage cause by the spray 
        if (not isTimer(pause)) then  
            local health = getElementHealth(localPlayer) 
            if (health < 99) then 
            triggerServerEvent("medic:healing", localPlayer, attacker)  
            pause = setTimer(function() end, 1000, 1) - 
            end 
        end 
    end 
end) 

Ty :)

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