Jump to content

colshipe stuff


abdalbaset

Recommended Posts

Posted

Or do you mean safezones? Like a player gets killed randomly anywhere on the map and spawns within a colshape?

And now Aurora is back again, pm for more info.

Ex. Lead dev & L6 Staff at AUR, NGC, MTA RP & SAA.

Ex. Developer at Community of Social Gamers - CSG

Ex Founder of International Gaming Community - IGC and Union of Individual Players- UIP

9o6E8.png Ab-47

Posted
  
local Col = createColCuboid(1290.5771,2100,11.0156, 300, 100, 30) 
local pArea1 = createRadarArea( 1290.5771,2100,200, 150, 32, 32,32) 
  
  
function shapeHit ( thePlayer )  
  
 givePlayerMoney (thePlayer , 1000 ) 
end 
  
addEventHandler('onColShapeHit', Col,shapeHit) 
  
  

that all what i made

>

Posted
local Col = createColCuboid(1290.5771,2100,11.0156, 300, 100, 30) 
local pArea1 = createRadarArea( 1290.5771,2100,200, 150, 32, 32,32) 
bool = false 
  
function shapeHit( thePlayer ) 
    givePlayerMoney (thePlayer , 1000 ) 
end  
addEventHandler('onColShapeHit', Col,shapeHit) 
  
function onWasted() 
    if isElementWithinColShape( source, Col )  
        bool = true 
    end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), onWasted ) 
  
function onSpawn() 
    if bool then 
    --setElementPosition 
    end 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), onSpawn ) 

jIcd9sc.png

Not worry about the future. Very soon it will come.

  • Moderators
Posted

@Banex

Serverside is managing multiply players, the variable bool is used by all.

Use a table (or elementdata for beginners) instead.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
  
local Col = createColCuboid(1290.5771,2100,11.0156, 300, 100, 30) 
local pArea1 = createRadarArea( 1290.5771,2100,200, 150, 32, 32,32) 
bool = false 
  
function shapeHit( thePlayer ) 
    givePlayerMoney (thePlayer , 1000 ) 
end 
addEventHandler('onColShapeHit', Col,shapeHit) 
  
function onWasted() 
    if isElementWithinColShape( source, Col ) 
        bool = true 
    end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), onWasted ) 
  
  
function onSpawn() 
    if bool then 
    setElementPosition (--here??,1369.93,2194.938,9.757) 
    end 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), onSpawn ) 
  
  

what should i put instead of "--here??" ,is that serverside or client side ,thanx for your help :)

>

Posted
local Col = createColCuboid(1290.5771,2100,11.0156, 300, 100, 30) 
local pArea1 = createRadarArea( 1290.5771,2100,200, 150, 32, 32,32) 
bool = false 
  
function shapeHit( thePlayer ) 
    givePlayerMoney (thePlayer , 1000 ) 
end  
addEventHandler('onColShapeHit', Col,shapeHit) 
  
function onWasted() 
    if isElementWithinColShape( source, Col )  
        bool = true 
    end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), onWasted ) 
  
function onSpawn() 
    if bool then 
    --setElementPosition 
    end 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), onSpawn ) 

it's not working i cant see the colshape on the map anymore

>

Posted

@IIYAMA you're right, I do not really know where I was thinking that day.

This should work:

server side

local Col = createColCuboid(1290.5771,2100,11.0156, 300, 100, 30) 
local pArea1 = createRadarArea( 1290.5771,2100,200, 150, 32, 32,32) 
local inColShape = { } 
  
function shapeHit( thePlayer ) 
    givePlayerMoney (thePlayer , 1000 ) 
end 
addEventHandler('onColShapeHit', Col,shapeHit) 
  
function onWasted() 
    if isElementWithinColShape( source, Col ) then 
        inColShape[source] = true 
    else 
        inColShape[source] = false 
    end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), onWasted ) 
  
function onSpawn() 
    if inColShape[source] then 
        setElementPosition(source, 1290.5771,2100,11.0156) 
    end 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), onSpawn ) 

jIcd9sc.png

Not worry about the future. Very soon it will come.

Posted
  
  
kills 
addEventHandler( "onPlayerWasted", getRootElement(), 
       function( killer ) 
           givePlayerMoney( killer, 100 ) 
         kills=kills+1 
       end 
) 
  
  

like that?

>

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