Imposter Posted July 6, 2012 Posted July 6, 2012 function playerTeamC () local playerTeam = getPlayerTeam ( source ) outputChatBox ( playerTeam, source ) end addEventHandler ( "onPlayerSpawn", source, playerTeamC) This should work shouldn't it? I get this message in the console "WARNING: [GRNFS]\gr_cteam\server.lua:2: Bad 'player' pointer @ 'getPlayerTeam'(1) Eat My Dust - DM/Deathmatch
Castillo Posted July 6, 2012 Posted July 6, 2012 function playerTeamC () local playerTeam = getPlayerTeam ( source ) outputChatBox ( getTeamName ( playerTeam ), source ) end addEventHandler ( "onPlayerSpawn", root, playerTeamC) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Imposter Posted July 6, 2012 Author Posted July 6, 2012 function playerTeamC () local playerTeam = getPlayerTeam ( source ) outputChatBox ( getTeamName ( playerTeam ), source ) end addEventHandler ( "onPlayerSpawn", root, playerTeamC) thanks again! Eat My Dust - DM/Deathmatch
Castillo Posted July 6, 2012 Posted July 6, 2012 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Imposter Posted July 6, 2012 Author Posted July 6, 2012 can you please explain why this doesnt work? function damage() playerTeam = getTeamName ( getPlayerTeam ( source ) ) if playerTeam == ("Police Officers") then outputChatBox ("COP",source) else outputChatBox ("Not A COP",source) end if end addEventHandler( "onVehicleDamage", root, damage) Eat My Dust - DM/Deathmatch
Castillo Posted July 6, 2012 Posted July 6, 2012 'source' of 'onVehicleDamage' is the vehicle that got damaged, not a player. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Imposter Posted July 6, 2012 Author Posted July 6, 2012 'source' of 'onVehicleDamage' is the vehicle that got damaged, not a player. how can i change it so if my car is damaged and my team is "Police Officers" it says you are a cop? Eat My Dust - DM/Deathmatch
Castillo Posted July 6, 2012 Posted July 6, 2012 Use the function: getVehicleController to get the vehicle driver. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Imposter Posted July 6, 2012 Author Posted July 6, 2012 Use the function: getVehicleController to get the vehicle driver. i suck at this, cant get anything right would you mind helping me out with the previous code you gave me? --if you still remember, it tells the zoneowner if there is a player in it, now i want to change it so it only tells a person in the team "Street Racers" that there is a player in the "Police Officers" Team nearby when a player from the "Police Officers" team steps in the collision. local playerZones = { } addEventHandler ( "onResourceStart", resourceRoot, function ( ) for index, player in ipairs ( getElementsByType ( "player" ) ) do playerZones [ player ] = createColTube ( 0, 0, 0, 10.0, 100.0 ) attachElements ( playerZones [ player ], player, 0, 0, 0 ) setElementData ( playerZones [ player ], "zoneOwner", player ) addEventHandler ( "onColShapeHit", playerZones [ player ], zoneEnter ) end end ) function createZone ( ) playerZones [ source ] = createColTube ( 0, 0, 0, 10.0, 100.0 ) attachElements ( playerZones [ source ], source, 0, 0, 0 ) setElementData ( playerZones [ source ], "zoneOwner", source ) addEventHandler ( "onColShapeHit", playerZones [ source ], zoneEnter ) playerTeam = getTeamName ( getPlayerTeam ( source ) ) outputChatBox ( playerTeam, source ) end addEventHandler ( "onPlayerJoin", root, createZone ) addEventHandler ( "onPlayerSpawn", root, createZone ) function destroyZone ( ) if ( isElement ( playerZones [ source ] ) ) then destroyElement ( playerZones [ source ] ) end end addEventHandler ( "onPlayerQuit", root, destroyZone ) function zoneEnter ( ) if ( zoneOwner ) == false then outputChatBox ("There is a player in your zone!",zoneOwner) end end function giveMoney ( ) for index, player in ipairs ( getElementsWithinColShape ( playerZone, "player" ) ) do givePlayerMoney ( player, 5000 ) outputChatBox ("Congratulations, you have been rewarded $5000 for capturing " .. root ,player) destroyZone() end end addEventHandler ( "onPlayerWasted", root, giveMoney ) Eat My Dust - DM/Deathmatch
Castillo Posted July 6, 2012 Posted July 6, 2012 if ( zoneOwner ) == false then Why you set "== false"?? that'll check if the zone doesn't has a owner, remove "== false". San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Imposter Posted July 6, 2012 Author Posted July 6, 2012 if ( zoneOwner ) == false then i want it to check if it isnt the zoneowner Eat My Dust - DM/Deathmatch
albers14 Posted July 6, 2012 Posted July 6, 2012 if getElementData(source, 'zoneOwner') == 'false' then setElementData ( playerZones [ source ], "zoneOwner", source --true/false? )
Castillo Posted July 7, 2012 Posted July 7, 2012 --if you still remember, it tells the zoneowner if there is a player in it, now i want to change it so it only tells a person in the team "Street Racers" that there is a player in the "Police Officers" Team nearby when a player from the "Police Officers" team steps in the collision. local playerZones = { } addEventHandler ( "onResourceStart", resourceRoot, function ( ) for index, player in ipairs ( getElementsByType ( "player" ) ) do playerZones [ player ] = createColTube ( 0, 0, 0, 10.0, 100.0 ) attachElements ( playerZones [ player ], player, 0, 0, 0 ) setElementData ( playerZones [ player ], "zoneOwner", player ) addEventHandler ( "onColShapeHit", playerZones [ player ], zoneEnter ) end end ) function createZone ( ) playerZones [ source ] = createColTube ( 0, 0, 0, 10.0, 100.0 ) attachElements ( playerZones [ source ], source, 0, 0, 0 ) setElementData ( playerZones [ source ], "zoneOwner", source ) addEventHandler ( "onColShapeHit", playerZones [ source ], zoneEnter ) playerTeam = getTeamName ( getPlayerTeam ( source ) ) outputChatBox ( playerTeam, source ) end addEventHandler ( "onPlayerJoin", root, createZone ) addEventHandler ( "onPlayerSpawn", root, createZone ) function destroyZone ( ) if ( isElement ( playerZones [ source ] ) ) then destroyElement ( playerZones [ source ] ) end end addEventHandler ( "onPlayerQuit", root, destroyZone ) function zoneEnter ( hitElement ) local zoneOwner = getElementData ( source, "zoneOwner" ) if ( zoneOwner ~= hitElement ) then outputChatBox ( "There is a player in your zone!", zoneOwner ) end end function giveMoney ( ) for index, player in ipairs ( getElementsWithinColShape ( playerZone, "player" ) ) do givePlayerMoney ( player, 5000 ) outputChatBox ("Congratulations, you have been rewarded $5000 for capturing " .. root ,player) destroyZone() end end addEventHandler ( "onPlayerWasted", root, giveMoney ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Jokeℝ1472771893 Posted August 4, 2012 Posted August 4, 2012 i have question:can we use this like turf system
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now