Jump to content

[Help]Enter on marker with gang_system


Hassam

Recommended Posts

Posted

Hello,

I'm trying add marker and when enter with this name specific but I can't.I'm using gang_system from castillo

  
function swatjob(hitElement) 
     if (hitElement  == localPlayer) then 
        if ( getElementData ( hitElement, "Gang Name" ) == "SWAT Team" ) then 
          if not guiGetVisible(windowjob) then 
               guiSetVisible(windowjob, true) 
               showCursor(true) 
          end 
         end 
         end 
     end 
addEventHandler("onClientMarkerHit", marker, swatjob) 

Posted

you forgot one 'end'

function swatjob(hitElement) 
     if (hitElement  == localPlayer) then 
        if ( getElementData ( hitElement, "Gang Name" ) == "SWAT Team" ) then 
          if not guiGetVisible(windowjob) then 
               guiSetVisible(windowjob, true) 
               showCursor(true) 
          end 
         end 
     end 
end 
addEventHandler("onClientMarkerHit", marker, swatjob) 

CiTLh.png
Posted
it's fixed, and don't worked

fixed and don't worked? ~_~

are you sure from the element data key? i mean this "Gang Name"

anyway where is your marker code?

did you check /debugscript 3? no error?

CiTLh.png
Posted

No error, and when I enter on mark, I can't see the gui

Edit:Here marker code:

local marker = createMarker(1262.7073974609, -1643.3990478516, 13, 'cylinder', 2, 255, 255, 255, 255) 

Posted

try

local marker = createMarker(1262.7073974609, -1643.3990478516, 13, 'cylinder', 2, 255, 255, 255, 255) 
  
function swatjob(hitElement) 
     if (hitElement == localPlayer) then 
          if (getElementData(hitElement, "gang") == "SWAT Team") then 
               if not guiGetVisible(windowjob) then 
                    guiSetVisible(windowjob, true) 
                    showCursor(true) 
               end 
          end 
     end 
end 
addEventHandler("onClientMarkerHit", marker, swatjob) 

CiTLh.png
Posted
no, didn't worked, I think need export the script

impossible, show your full code, include the gui

CiTLh.png
Posted
local marker = createMarker(1262.7073974609, -1643.3990478516, 13, 'cylinder', 2, 255, 255, 255, 255) 
  
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Label = {} 
  
windowjob = guiCreateWindow(1031,232,301,397,"SWAT 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_Label[1] = guiCreateLabel(19,33,273,215,"To take SWAT team job, press Take job.\n\nIf you don't want to, press Cancel.",false,windowjob) 
  
function swatjob(hitElement) 
     if (hitElement == localPlayer) then 
          if (getElementData(hitElement, "gang") == "SWAT Team") then 
               if not guiGetVisible(windowjob) then 
                    guiSetVisible(windowjob, true) 
                    showCursor(true) 
               end 
          end 
     end 
end 
addEventHandler("onClientMarkerHit", marker, swatjob) 
  
function swatjobleave(leaveElement) 
     if getElementType(leaveElement) == "player" then 
          if guiGetVisible(windowjob) then 
               guiSetVisible(windowjob, false) 
               showCursor(false) 
          end 
     end 
end 
addEventHandler("onClientMarkerLeave", marker, swatjobleave) 
  
function joinTeam() 
     triggerServerEvent("setswat",localPlayer) 
     guiSetVisible(windowjob, false) 
     showCursor(false) 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) 
  
function removeswatWindow() 
     guiSetVisible(windowjob, false) 
     showCursor(false) 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeswatWindow, false) 

Posted
local marker = createMarker(1262.7073974609, -1643.3990478516, 13, 'cylinder', 2, 255, 255, 255, 255) 
  
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Label = {} 
local x,y = guiGetScreenSize() 
  
windowjob = guiCreateWindow(x/2-150,y/2-199,301,397,"SWAT 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_Label[1] = guiCreateLabel(19,33,273,215,"To take SWAT team job, press Take job.\n\nIf you don't want to, press Cancel.",false,windowjob) 
  
function swatjob(hitElement) 
     if (hitElement == localPlayer) then 
          if (getElementData(hitElement, "gang") == "SWAT Team") then 
               if not guiGetVisible(windowjob) then 
                    guiSetVisible(windowjob, true) 
                    showCursor(true) 
               end 
          end 
     end 
end 
addEventHandler("onClientMarkerHit", marker, swatjob) 
  
function swatjobleave(leaveElement) 
     if getElementType(leaveElement) == "player" then 
          if guiGetVisible(windowjob) then 
               guiSetVisible(windowjob, false) 
               showCursor(false) 
          end 
     end 
end 
addEventHandler("onClientMarkerLeave", marker, swatjobleave) 
  
function joinTeam() 
     triggerServerEvent("setswat",localPlayer) 
     guiSetVisible(windowjob, false) 
     showCursor(false) 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) 
  
function removeswatWindow() 
     guiSetVisible(windowjob, false) 
     showCursor(false) 
end 
addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeswatWindow, false) 

CiTLh.png
Posted
isGangMember - Arguments: gangName, accountName. Returns: true or false.

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

Posted

The resource: "gang_system" uses "gang" element data as TAPL used on his code.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
The resource: "gang_system" uses "gang" element data as TAPL used on his code.

Would not be easier using "isGangMember"?

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

Posted

His script is client side, that function is server side as it uses account names.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Oh, didn't see :D

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

Posted

I don't understand what do you mean.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
setPlayerTeam -- to set the player team 
setElementModel -- to set the player skin. 

You could combine it with: onElementDataChange, so when your "Occupation" element data changes to "SWAT" it'll auto set team + skin.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
EDIT: how to make when i take Swat job my team set "SWAT Team" + Skin (ID)

This is the server side part

the topic owner didn't post it

you have to make it

the trigger already there

in line 38

triggerServerEvent("setswat",localPlayer) 

CiTLh.png

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