Jump to content

Gang Creation


Axel

Recommended Posts

So i made a command to create a gang using setElementData. But it will create a gang only named "King", how can i make to create a gang i want. Like /creategang Kingdom creates gang Kingdom.

  
function createCommand ( thePlayer, command,gangname ) 
  setElementData(thePlayer,"gang","King") 
  g= getElementData(thePlayer,"gang")  
  outputChatBox ("The gang "..g.." has been sucessfuly created!", thePlayer, 255, 0, 0, false ) 
end 
addCommandHandler ( "creategang", createCommand ,gangname) 
  

Link to comment

By changing "King" in setElementData to gangname

function createCommand ( thePlayer, command,gangname ) 
  setElementData(thePlayer,"gang",gangname) 
  g= getElementData(thePlayer,"gang") 
  outputChatBox ("The gang "..g.." has been sucessfuly created!", thePlayer, 255, 0, 0, false ) 
end 
addCommandHandler ( "creategang", createCommand ,gangname) 

Link to comment

Thanks.

But now i am creating a truf in a zone and it does not appear.

 radar = createRadarArea(2444,-1720,100,100) 
color = setRadarAreaColor(radar,255,255,0,0) 
  
function createCommand ( thePlayer, command,gangname ) 
  setElementData(thePlayer,"gang",gangname) 
  g= getElementData(thePlayer,"gang")  outputChatBox ("The gang "..g.." has been sucessfuly created!", thePlayer, 255, 0, 0, false ) 
end 
addCommandHandler ( "creategang", createCommand ,gangname) 
  

Should i use createColRectangle too?

Link to comment

That's because you setting the radar area color alpha to 0

radar = createRadarArea(2444,-1720,100,100) 
color = setRadarAreaColor(radar,255,255,0,255) 
  
function createCommand ( thePlayer, command,gangname ) 
  setElementData(thePlayer,"gang",gangname) 
  g= getElementData(thePlayer,"gang")  outputChatBox ("The gang "..g.." has been sucessfuly created!", thePlayer, 255, 0, 0, false ) 
end 
addCommandHandler ( "creategang", createCommand ,gangname) 

Link to comment
radar = createRadarArea(2444,-1720,100,100) 
color = setRadarAreaColor(radar,255,255,0,255) 
  
function createCommand ( thePlayer, command,gangname, r, g, b ) 
  setElementData(thePlayer,"gang",gangname) 
local radar = createRadarArea(2444,-1720,100,100) 
setRadarAreaColor(radar,r,g,b,255) 
  g= getElementData(thePlayer,"gang")  outputChatBox ("The gang "..g.." has been sucessfuly created!", thePlayer, 255, 0, 0, false ) 
end 
addCommandHandler ( "creategang", createCommand ,gangname) 

Link to comment

I want to check if thePlayer entered the area, i used isInsideRadarArea and it does not work.

  
function isElementInsideRadarArea(thePlayer,radar) 
 local X,Y = getElementPosition(thePlayer) 
 return isInsideRadarArea(radar,X,Y) 
 outPutChatBox("Test",255,0,0) 
end 
  

Link to comment
isInsideRadarArea() does not work correctly on the server.

And it's outputChatBox not outPutChatBox

Also when return is used the function stops, so outputChatBox should be before return.

function isReallyInsideRadarArea ( theArea, x, y ) 
    local posX, posY = getElementPosition ( theArea ) 
    local sizeX, sizeY = getRadarAreaSize ( theArea ) 
    return (x >= posX) and (x <= posX + sizeX) and (y >= posY) and (y <= posY + sizeY)  
end 
  
function isElementInsideRadarArea(thePlayer,radar) 
 local X,Y = getElementPosition(thePlayer) 
 outputChatBox("Test",root, 255,0,0) 
 return isReallyInsideRadarArea(radar,X,Y) 
end 
  

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