Jump to content

Class>Moving Gate


DonPro

Recommended Posts

Hey, i have been trying in a while now to get this Moving gate to be working ONLY for the Class spawn. but its a bug, when i spawn as test i see the gate is opening for this spawn to. someone that could help me with it?

   a51gate1 = createObject ( 3037, 2360.89, -1272.40, 24.89, 0, 0, 0 ) 
   a51col = createColCircle ( 2360.69, -1271.90, 4 ) 
  
function opena51gates(thePlayer) 
if getElementData(source, "class") ~= "Crip" and getElementData(source, "class") ~= "Crip" and getElementData(source, "class") ~= "Crip" then 
       moveObject (a51gate1, 2000, 2360.89, -1280.59, 24.89 ) 
end 
end addEventHandler( "onColShapeHit", a51col, opena51gates ) 
  
function closea51gates(thePlayer) 
if getElementData(source, "class") ~= "Crip" and getElementData(source, "class") ~= "Crip" and getElementData(source, "class") ~= "Crip" then 
       moveObject (a51gate1, 2000, 2360.89, -1272.40, 24.89 ) 
end 
end addEventHandler( "onColShapeLeave", a51col, closea51gates ) 

I dont know if im gonna write the name on the skin or only the Class name but this script up here is only for the Skins :P

Link to comment

In onColShapeHit and onColShapeLeave the source is the colshape, try Use thePlayer:

  a51gate1 = createObject ( 3037, 2360.89, -1272.40, 24.89, 0, 0, 0 ) 
   a51col = createColCircle ( 2360.69, -1271.90, 4 ) 
  
function opena51gates(thePlayer) 
if getElementData(thePlayer, "class") ~= "Crip" then 
       moveObject (a51gate1, 2000, 2360.89, -1280.59, 24.89 ) 
end 
end addEventHandler( "onColShapeHit", a51col, opena51gates ) 
  
function closea51gates(thePlayer) 
if getElementData(thePlayer, "class") ~= "Crip" then 
       moveObject (a51gate1, 2000, 2360.89, -1272.40, 24.89 ) 
end 
end addEventHandler( "onColShapeLeave", a51col, closea51gates ) 

Link to comment
In onColShapeHit and onColShapeLeave the source is the colshape, try Use thePlayer:
  a51gate1 = createObject ( 3037, 2360.89, -1272.40, 24.89, 0, 0, 0 ) 
   a51col = createColCircle ( 2360.69, -1271.90, 4 ) 
  
function opena51gates(thePlayer) 
if getElementData(thePlayer, "class") ~= "Crip" then 
       moveObject (a51gate1, 2000, 2360.89, -1280.59, 24.89 ) 
end 
end addEventHandler( "onColShapeHit", a51col, opena51gates ) 
  
function closea51gates(thePlayer) 
if getElementData(thePlayer, "class") ~= "Crip" then 
       moveObject (a51gate1, 2000, 2360.89, -1272.40, 24.89 ) 
end 
end addEventHandler( "onColShapeLeave", a51col, closea51gates ) 

Hi Thanks both, but its still opens for all. the Spawn list is an .map file is that maby why its does not activate this Moving gate script?

Link to comment
Hi Thanks both, but its still opens for all. the Spawn list is an .map file is that maby why its does not activate this Moving gate script?

Try this code, this only open for players with element data "class" = "Crip":

a51gate1 = createObject ( 3037, 2360.89, -1272.40, 24.89, 0, 0, 0 ) 
a51col = createColCircle ( 2360.69, -1271.90, 4 ) 
      
function opena51gates(thePlayer) 
    if getElementData(thePlayer, "class") == "Crip" then 
           moveObject (a51gate1, 2000, 2360.89, -1280.59, 24.89 ) 
    end 
end 
addEventHandler( "onColShapeHit", a51col, opena51gates ) 
      
function closea51gates(thePlayer) 
    if getElementData(thePlayer, "class") == "Crip" then 
           moveObject (a51gate1, 2000, 2360.89, -1272.40, 24.89 ) 
    end 
end  
addEventHandler( "onColShapeLeave", a51col, closea51gates ) 

Link to comment
Hi Thanks both, but its still opens for all. the Spawn list is an .map file is that maby why its does not activate this Moving gate script?

Try this code, this only open for players with element data "class" = "Crip":

a51gate1 = createObject ( 3037, 2360.89, -1272.40, 24.89, 0, 0, 0 ) 
a51col = createColCircle ( 2360.69, -1271.90, 4 ) 
      
function opena51gates(thePlayer) 
    if getElementData(thePlayer, "class") == "Crip" then 
           moveObject (a51gate1, 2000, 2360.89, -1280.59, 24.89 ) 
    end 
end 
addEventHandler( "onColShapeHit", a51col, opena51gates ) 
      
function closea51gates(thePlayer) 
    if getElementData(thePlayer, "class") == "Crip" then 
           moveObject (a51gate1, 2000, 2360.89, -1272.40, 24.89 ) 
    end 
end  
addEventHandler( "onColShapeLeave", a51col, closea51gates ) 

Now noone can use it :S

Link to comment

Now noone can use it :S

This works when I use this code:

setElementData ( getPlayerFromName("Duh"), "class", "Crip" ) 

Do i have to write all members who is allowed to use this when they are spawned as that class?

Yes, but Change getPlayerFromName("Duh").

Link to comment

hmm, my plan once is to get the spawn up to class, and when the owner of a Gang/Squad invite a player to the gang he can use the spawn and the gate without that i have to go into the script and put him into there :( thats why i want this script to work as CLASS :S

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