CobbTheWarriorsRPG Posted August 20, 2013 Share Posted August 20, 2013 Hello i am making a base system based on turfsystem by Sasuke* i want when you capture a thing your "clan" or "gang" get some things.... there its my script local marker1 = createMarker( 1961.9000244141, -2214.6000976563, 16.10000038147, 'cylinder', 2.0, 255, 0, 0, 150) local ItemAzar = { "Pasta Can", "Beans Can", "Burger", "Pizza", "Soda Bottle", "Empty Soda Cans", "Scruffy Burgers", "Milk", "Raw Meat", "Cooked Meat" , "Wood Pile", "Empty Gas Canister", "Full Gas Canister", "Roadflare", "Wire Fence", "Tent", "Tire", "Engine", "Tank Parts", "Camouflage Clothing", "Ghillie Suit", "Civilian Clothing", "Survivor Clothing", "Box of Matches", "Infrared Goggles", "Night Vision Goggles", "GPS", "Map", "Toolbox", "Watch", "Radio Device", } function MarkerHit1 ( player ) local playerGang = getElementData ( player, "gang" ) local turfGang = getElementData ( marker1, "getTurfGang", true ) if (turfGang == playerGang) then outputChatBox("Esta base ya pertence a "..turfGang, player, 0, 255, 0, false) else if not getPlayerTeam(player) then return end local team = getPlayerTeam ( player ) if (getTeamName( team ) == "geral") then local playerGang = getElementData ( player, "gang" ) if ( playerGang ) then if ( isTimer ( beachturfTimer ) ) then return end if not (turfGang == playerGang) then if isTimer(floodTimer) then return else outputChatBox("[ALERTA]Estan tomando la base en "..getElementZoneName(marker1)..","..getElementZoneName(marker1,true)) floodTimer = setTimer(function() end, 5000, 1) end end local r, g, b = unpack ( exports [ "gang_system" ]:getGangColor ( playerGang ) ) local turfGang = getElementData ( marker1, "getTurfGang", true ) if turfGang then outputChatBox("Entraste En La Base de "..turfGang..". Espera 2 Minutos Para Poder Conquistar la base Y Ganar la base", player, 0, 255, 0, false) else outputChatBox("Esta base Aun No Pertenese A Nadie. Espera 2 Minutos Para Poder Conquistarla", player, 0, 255, 0, false) end beachturfTimer1 = setTimer ( function ( ) if isElementWithinMarker ( player, marker1 ) then setMarkerColor ( marker1, tonumber(r), tonumber(g), tonumber(b), 100 ) outputChatBox("Felicidades Conquistaste la base!", player, 0, 255, 0, false) triggerClientEvent("onTakeTurf", player) givePlayerMoney ( player, 4000 ) setElementData ( marker1, "getTurfGang", playerGang ) setCameraMatrix(player, 1939.5476074219, -2162.421875, 39.010345458984, 1961.9000244141, -2214.6000976563, 16.10000038147, 0, 70) setTimer(function(player) if isElement(player) then setCameraTarget(player) end end,5000,1,player) end end ,3000, 1 ) end end end end addEventHandler( "onMarkerHit", marker1, MarkerHit1 ) function StopTurf ( player ) if ( isTimer ( beachturfTimer1 ) ) then killTimer ( beachturfTimer1 ); end outputChatBox("Has abandonado la base", source) end addEventHandler ( "onMarkerLeave", marker1, StopTurf ) -- here the code to give things function GiveObjects(player) if (turfGang == playerGang) then setElementData( player,ItemAzar[ math.random(1, #ItemAzar)], 1) end end setTimer ( GiveObjects, 3000, 0, player ) but it gives to me [2013-08-20 16:44:28] WARNING: basesita\serverTurf.lua:111: Bad argument @ 'setElementData' [Expected element at argument 1, got nil] Link to comment
Castillo Posted August 20, 2013 Share Posted August 20, 2013 That's because "player" is not defined anywhere. Link to comment
CobbTheWarriorsRPG Posted August 20, 2013 Author Share Posted August 20, 2013 That's because "player" is not defined anywhere. @Solidsnake14 and how can i define it? Link to comment
Castillo Posted August 20, 2013 Share Posted August 20, 2013 What are you trying to do? Link to comment
CobbTheWarriorsRPG Posted August 20, 2013 Author Share Posted August 20, 2013 A base system if you capture the marker all the clan members got the items Link to comment
Castillo Posted August 20, 2013 Share Posted August 20, 2013 Why are you putting it outside the function of capture then? Link to comment
CobbTheWarriorsRPG Posted August 20, 2013 Author Share Posted August 20, 2013 Dunno bro i make this function MarkerHit1 ( player ) local playerGang = getElementData ( player, "gang" ) local turfGang = getElementData ( marker1, "getTurfGang", true ) if (turfGang == playerGang) then outputChatBox("Esta base ya pertence a "..turfGang, player, 0, 255, 0, false) else if not getPlayerTeam(player) then return end local team = getPlayerTeam ( player ) if (getTeamName( team ) == "geral") then local playerGang = getElementData ( player, "gang" ) if ( playerGang ) then if ( isTimer ( beachturfTimer ) ) then return end if not (turfGang == playerGang) then if isTimer(floodTimer) then return else outputChatBox("[ALERTA]Estan tomando la base en "..getElementZoneName(marker1)..","..getElementZoneName(marker1,true)) floodTimer = setTimer(function() end, 5000, 1) end end local r, g, b = unpack ( exports [ "gang_system" ]:getGangColor ( playerGang ) ) local turfGang = getElementData ( marker1, "getTurfGang", true ) if turfGang then outputChatBox("Entraste En La Base de "..turfGang..". Espera 2 Minutos Para Poder Conquistar la base Y Ganar la base", player, 0, 255, 0, false) else outputChatBox("Esta base Aun No Pertenese A Nadie. Espera 2 Minutos Para Poder Conquistarla", player, 0, 255, 0, false) end beachturfTimer1 = setTimer ( function ( ) if isElementWithinMarker ( player, marker1 ) then setMarkerColor ( marker1, tonumber(r), tonumber(g), tonumber(b), 100 ) outputChatBox("Felicidades Conquistaste la base!", player, 0, 255, 0, false) triggerClientEvent("onTakeTurf", player) givePlayerMoney ( player, 4000 ) setElementData ( marker1, "getTurfGang", playerGang ) setCameraMatrix(player, 1939.5476074219, -2162.421875, 39.010345458984, 1961.9000244141, -2214.6000976563, 16.10000038147, 0, 70) setTimer(function(player) if isElement(player) then setCameraTarget(player) end end,5000,1,player) -- here behind setTimer ( function() if exports [ "gang_system" ]:getGangMembers ( playerGang ) then setElementData( player,ItemAzar[ math.random(1, #ItemAzar)], 1) end end, 5000, 0 ) end end ,3000, 1 ) end end end end addEventHandler( "onMarkerHit", marker1, MarkerHit1 ) its a export i dont know its good Link to comment
Castillo Posted August 20, 2013 Share Posted August 20, 2013 function MarkerHit1 ( player ) local playerGang = getElementData ( player, "gang" ) local turfGang = getElementData ( marker1, "getTurfGang" ) if ( turfGang == playerGang ) then outputChatBox ( "Esta base ya pertence a ".. turfGang, player, 0, 255, 0, false ) else if ( not getPlayerTeam ( player ) ) then return end local team = getPlayerTeam ( player ) if ( getTeamName ( team ) == "geral" ) then local playerGang = getElementData ( player, "gang" ) if ( playerGang ) then if ( isTimer ( beachturfTimer ) ) then return end if ( turfGang ~= playerGang ) then if isTimer ( floodTimer ) then return else outputChatBox ( "[ALERTA]Estan tomando la base en ".. getElementZoneName ( marker1 ) ..",".. getElementZoneName ( marker1, true ) ) floodTimer = setTimer ( function ( ) end, 5000, 1 ) end end local r, g, b = unpack ( exports [ "gang_system" ]:getGangColor ( playerGang ) ) local turfGang = getElementData ( marker1, "getTurfGang" ) if ( turfGang ) then outputChatBox ( "Entraste En La Base de ".. turfGang ..". Espera 2 Minutos Para Poder Conquistar la base Y Ganar la base", player, 0, 255, 0, false ) else outputChatBox ( "Esta base Aun No Pertenese A Nadie. Espera 2 Minutos Para Poder Conquistarla", player, 0, 255, 0, false ) end beachturfTimer1 = setTimer ( function ( ) if isElementWithinMarker ( player, marker1 ) then setMarkerColor ( marker1, tonumber ( r ), tonumber ( g ), tonumber ( b ), 100 ) outputChatBox ( "Felicidades Conquistaste la base!", player, 0, 255, 0, false ) triggerClientEvent ( "onTakeTurf", player ) givePlayerMoney ( player, 4000 ) setElementData ( marker1, "getTurfGang", playerGang ) setCameraMatrix ( player, 1939.5476074219, -2162.421875, 39.010345458984, 1961.9000244141, -2214.6000976563, 16.10000038147, 0, 70 ) setTimer ( function ( player ) if isElement ( player ) then setCameraTarget ( player ) end end ,5000, 1, player ) -- here behind setElementData ( player, ItemAzar [ math.random ( 1, #ItemAzar ) ], 1 ) end end ,3000, 1 ) end end end end addEventHandler ( "onMarkerHit", marker1, MarkerHit1 ) Try it. Link to comment
CobbTheWarriorsRPG Posted August 21, 2013 Author Share Posted August 21, 2013 Yeah But the script only gives 1 thing to the player who hit the marker ,i want to give the items ( set element data) to all the players who are in the gang of the player who hits the marker I made This code but it doesnt work local marker1 = createMarker( 1961.9000244141, -2214.6000976563, 16.10000038147, 'cylinder', 2.0, 255, 0, 0, 150) local marker2 = createMarker( -783, -2016.8000488281, 8.1000003814697, 'cylinder', 2.0, 255, 0, 0, 150) local marker3 = createMarker( -1135.0999755859, -991.90002441406, 130.5, 'cylinder', 2.0, 255, 0, 0, 150) local marker4 = createMarker( -1356.5999755859, 509.70001220703, 11.199999809265, 'cylinder', 2.0, 255, 0, 0, 150) local marker5 = createMarker( 247.89999389648, 1859.3000488281, 13.10000038147, 'cylinder', 2.0, 255, 0, 0, 150) local ItemAzar = { "Pasta Can", "Beans Can", "Burger", "Pizza", "Soda Bottle", "Empty Soda Cans", "Scruffy Burgers", "Milk", "Raw Meat", "Cooked Meat" , "Wood Pile", "Empty Gas Canister", "Full Gas Canister", "Roadflare", "Wire Fence", "Tent", "Tire", "Engine", "Tank Parts", "Camouflage Clothing", "Ghillie Suit", "Civilian Clothing", "Survivor Clothing", "Box of Matches", "Infrared Goggles", "Night Vision Goggles", "GPS", "Map", "Toolbox", "Watch", "Radio Device", } function MarkerHit1 ( player ) local playerGang = getElementData ( player, "gang" ) local turfGang = getElementData ( marker1, "getTurfGang", true ) if (turfGang == playerGang) then outputChatBox("Esta base ya pertence a "..turfGang, player, 0, 255, 0, false) else if not getPlayerTeam(player) then return end local team = getPlayerTeam ( player ) if (getTeamName( team ) == "geral") then local playerGang = getElementData ( player, "gang" ) if ( playerGang ) then if ( isTimer ( beachturfTimer ) ) then return end if not (turfGang == playerGang) then if isTimer(floodTimer) then return else outputChatBox("[ALERTA]Estan tomando la base en "..getElementZoneName(marker1)..","..getElementZoneName(marker1,true)) floodTimer = setTimer(function() end, 5000, 1) end end local r, g, b = unpack ( exports [ "gang_system" ]:getGangColor ( playerGang ) ) local turfGang = getElementData ( marker1, "getTurfGang", true ) if turfGang then outputChatBox("Entraste En La Base de "..turfGang..". Espera 2 Minutos Para Poder Conquistar la base Y Ganar la base", player, 0, 255, 0, false) else outputChatBox("Esta base Aun No Pertenese A Nadie. Espera 2 Minutos Para Poder Conquistarla", player, 0, 255, 0, false) end beachturfTimer1 = setTimer ( function ( ) if isElementWithinMarker ( player, marker1 ) then setMarkerColor ( marker1, tonumber(r), tonumber(g), tonumber(b), 100 ) outputChatBox("Felicidades Conquistaste la base!", player, 0, 255, 0, false) triggerClientEvent("onTakeTurf", player) givePlayerMoney ( player, 4000 ) setElementData ( marker1, "getTurfGang", playerGang ) setCameraMatrix(player, 1939.5476074219, -2162.421875, 39.010345458984, 1961.9000244141, -2214.6000976563, 16.10000038147, 0, 70) setTimer(function(player) if isElement(player) then setCameraTarget(player) end end,5000,1,player) --here setTimer ( function() if exports [ "gang_system" ]:getGangMembers ( playerGang ) then setElementData( playerGang,ItemAzar[ math.random(1, #ItemAzar)], 1) end end, 5000, 1 ) end end ,3000, 1 ) end end end end addEventHandler( "onMarkerHit", marker1, MarkerHit1 ) function StopTurf ( player ) if ( isTimer ( beachturfTimer1 ) ) then killTimer ( beachturfTimer1 ); end outputChatBox("Has abandonado la base", source) end addEventHandler ( "onMarkerLeave", marker1, StopTurf ) basicly my idea is if you have a "base" you clan or gang get random items in x time @Solidsnake14 can you help me please? Link to comment
Castillo Posted August 21, 2013 Share Posted August 21, 2013 function MarkerHit1 ( player ) local playerGang = getElementData ( player, "gang" ) local turfGang = getElementData ( marker1, "getTurfGang" ) if ( turfGang == playerGang ) then outputChatBox ( "Esta base ya pertence a ".. turfGang, player, 0, 255, 0, false ) else if ( not getPlayerTeam ( player ) ) then return end local team = getPlayerTeam ( player ) if ( getTeamName ( team ) == "geral" ) then local playerGang = getElementData ( player, "gang" ) if ( playerGang ) then if ( isTimer ( beachturfTimer ) ) then return end if ( turfGang ~= playerGang ) then if isTimer ( floodTimer ) then return else outputChatBox ( "[ALERTA]Estan tomando la base en ".. getElementZoneName ( marker1 ) ..",".. getElementZoneName ( marker1, true ) ) floodTimer = setTimer ( function ( ) end, 5000, 1 ) end end local r, g, b = unpack ( exports [ "gang_system" ]:getGangColor ( playerGang ) ) local turfGang = getElementData ( marker1, "getTurfGang" ) if ( turfGang ) then outputChatBox ( "Entraste En La Base de ".. turfGang ..". Espera 2 Minutos Para Poder Conquistar la base Y Ganar la base", player, 0, 255, 0, false ) else outputChatBox ( "Esta base Aun No Pertenese A Nadie. Espera 2 Minutos Para Poder Conquistarla", player, 0, 255, 0, false ) end beachturfTimer1 = setTimer ( function ( ) if isElementWithinMarker ( player, marker1 ) then setMarkerColor ( marker1, tonumber ( r ), tonumber ( g ), tonumber ( b ), 100 ) outputChatBox ( "Felicidades Conquistaste la base!", player, 0, 255, 0, false ) triggerClientEvent ( "onTakeTurf", player ) givePlayerMoney ( player, 4000 ) setElementData ( marker1, "getTurfGang", playerGang ) setCameraMatrix ( player, 1939.5476074219, -2162.421875, 39.010345458984, 1961.9000244141, -2214.6000976563, 16.10000038147, 0, 70 ) setTimer ( function ( player ) if isElement ( player ) then setCameraTarget ( player ) end end ,5000, 1, player ) for _, thePlayer in ipairs ( getElementsWithinColShape ( getElementColShape ( marker1 ), "player" ) ) do if ( getElementData ( thePlayer, "gang" ) == getElementData ( marker1, "getTurfGang" ) ) then setElementData ( thePlayer, ItemAzar [ math.random ( 1, #ItemAzar ) ], 1 ) end end end end ,3000, 1 ) end end end end addEventHandler ( "onMarkerHit", marker1, MarkerHit1 ) Link to comment
CobbTheWarriorsRPG Posted August 21, 2013 Author Share Posted August 21, 2013 Solved,By The PRO Of castillo Really Thanks. Link to comment
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