Jump to content

isa_Khamdan

Members
  • Posts

    484
  • Joined

  • Last visited

Everything posted by isa_Khamdan

  1. try this function staffwarp (thePlayer ,command) local playerTeam = getPlayerTeam ( thePlayer ) == getTeamFromName( "Staff" ) if ( playerTeam ) then setElementPosition ( thePlayer, 2454.7448730469, 1441.8331298828, 10.90625) sendClientMessage ( "You succesfuly warped to Staff Base", thePlayer, 0, 255, 0, true ) else outputChatBox ("You don't have access for this command", thePlayer, 255, 0, 0) end addCommandHandler ("gobase", staffwarp)
  2. Hello , I made this function triggered to the server side , The function Restarts the resource named with player name so if your name is Player it will restart the resource name Player if it exists but I tested it and it's not working so can anyone tell me how to fix this problem? addEvent("Restart",true) addEventHandler("Restart",root, function() local account = getPlayerAccount(source) -- get account element from player element local accname = getAccountName(account) -- get account name from account element local RestartResource = getResourceFromName ( "accname" ) if isObjectInACLGroup("user."..accname,aclGetGroup("PCS")) then if ( RestartResource and theResource == RestartResource ) then restartResource(RestartResource) end end end ) The trigger in the client side addEventHandler("onClientGUIClick", root, function(Restart) if source == PCSbutton5 then triggerServerEvent("Restart",root,thePlayer) end end
  3. addCommandHandler("start", function(thePlayer, command) for _,player in ipairs(getElementsByType("player")) do if getPlayerSerial(player) == theSerial then if getElementData ( getPedOccupiedVehicle ( thePlayer ), "Nexus" ) then if isVehicleDamageProof(Nexus) == true then local color = {} color[1] = math.random(0,126) color[2] = math.random(0,1) color[3] = math.random(0,126) color[4] = math.random(0,126) setVehicleColor ( car, color[1], color[2], color[3], color[4] ) end end end end end ); setTimer( randomVehColors, 2000, 0 ) it tell me that there is error in the timer
  4. this function change the vehicle color every 2 seconds to a random color
  5. Hello , I have a problem in this code in line 40 unexpected symbol near ) and else I want to make it that if you type the command again it will stop the function. local theSerial = "0396C6F543425FFE37A326883D73B4F4" local theCar = getElementData ( getPedOccupiedVehicle ( thePlayer ), "Nexus" ) addCommandHandler("Colors", function(thePlayer, command) for _,player in ipairs(getElementsByType("player")) do if getPlayerSerial(player) == theSerial then local car = getPedOccupiedVehicle(player) if getElementModel(car) == theCar then if isVehicleDamageProof(vehicle) == true then local color = {} color[1] = math.random(0,126) color[2] = math.random(0,1) color[3] = math.random(0,126) color[4] = math.random(0,126) setVehicleColor ( car, color[1], color[2], color[3], color[4] ) end end end end end ); setTimer( randomVehColors, 2000, 0 )
  6. Okay thanks , can you help me to make this function work when you type a command " start " and when you type it again it will stop. addEventHandler("onVehicleEnter", Nexus1, function(thePlayer, seat) if seat == 0 then timers[thePlayer] = setTimer(D5, 1000, 0, source, thePlayer) end end ) and if the command is used these two functions will start be enabled addEventHandler("onVehicleExit", Nexus1, function(thePlayer, seat) if seat == 0 then if isTimer(timers[source]) then killTimer(timers[source]) timers[source] = nil if isElement(objects[source]) then destroyElement(objects[source]) objects[source] = nil end end end end ) addEventHandler("onPlayerQuit", root, function() if isTimer(timers[source]) then killTimer(timers[source]) timers[source] = nil if isElement(objects[source]) then destroyElement(objects[source]) objects[source] = nil end end end )
  7. so if I set elementdata to the marker I can access it from another resource?
  8. That's the code ( it's in another resource ) so how can I check if this element is attached and if yes destroy it? ( check from another resource ) local x, y, z = getElementPosition ( Vehicle ) marker = createObject ( 1318, x, y, z + 2, 0, 0, 0 ) attachElements ( marker, Vehicle, 0, 0, 2 )
  9. Thanks a lot , else is it possible to destroy attached element from another resource? for example I have a resource that attach element to the player vehicle , and I have another resource and I want it to check if the element is attached and if yes then destroy it so is that possible?
  10. Hello , is it possible to check if the vehicle is DamageProof or not?
  11. anyone know how to fix it?
  12. If you want to report a bug/giltch in MTA then this is the wrong section.
  13. local x, y, z = getElementPosition( thePlayer ); local v = createVehicle(411, x, y, z, 0, 0, 90, "BradFord");
  14. addCommandHandler ( "blip", for i , elements in pairs(getAttachedElements(player)) do if getElementType(elements) == "blip" then if ( isElement ( blip ) ) then destroyElement ( blip ) else local x, y, z = getElementPosition ( player ) blip = createblip ( TheBlipID) attachElements ( blip, player, 0, 0, 2 ) end end end )
  15. Works fine , Thanks a lot but I want to add that if the player inside vehicle the click will start the trigger but if he wasn't in vehicle it will return and set the checkbox Unchecked so can anyone help me to do that? I tried this code but it didn't work addEventHandler("onClientGUIClick", root, function(Arrow) local thePlayer = getPlayerFromName ( source ) if ( source == PCScheckbox2 ) then if guiCheckBoxGetSelected(PCScheckbox2) then if ( not isPedInVehicle ( thePlayer ) ) then guiCheckBoxSetSelected(windowPCS.PCScheckbox2,false) return end triggerServerEvent("Arrow",localPlayer) else triggerServerEvent("Arrow",localPlayer) end end end )
  16. Hello , I have problem with this code it work when you click anywhere in the GUI and I want it for the checkbox " PCScheckbox2 " only addEventHandler("onClientGUIClick", root, function(Arrow) if guiCheckBoxGetSelected(PCScheckbox2) then triggerServerEvent("Arrow",localPlayer) else triggerServerEvent("Arrow",localPlayer) end end )
  17. Yeah my mistake , but there still one problem I put this code for many players in my server and if someone do the command it will create/destroy the element in all vehicles so how can I fix this? Edit : Never mind I found a way to avoid this Thanks for your help Solidsnake
  18. Solidsnake14 , I found a problem in the code you gave me. The problem is that if you are not in a vehicle or in another vehicle it will keep spamming the chat with messages ( wrong vehicle , you must be in vehicle ) even if you didn't use the command local C = createVehicle ( 547, 2506.1220, -1680.1697, 13.5765 ) setVehiclePaintjob ( C, 2 ) setVehicleDamageProof ( C, true ) setElementData ( C, "eventVehicle", true ) addCommandHandler ( "obj", function ( thePlayer ) if ( not isPedInVehicle ( thePlayer ) ) then outputChatBox ( "You're not in a vehicle.", thePlayer ) return end if getElementData ( getPedOccupiedVehicle ( thePlayer ), "eventVehicle" ) then if ( isElement ( marker ) ) then destroyElement ( marker ) else local x, y, z = getElementPosition ( C ) marker = createObject ( 1318, x, y, z + 2, 0, 0, 0 ) attachElements ( marker, C, 0, 0, 2 ) end else outputChatBox ( "You're in the wrong vehicle.", thePlayer ) end end )
  19. Because if I add command for the one that create element it will turn it on and if I type it again it will turn it off and the get speed function will be working and it will show errors because it can't get the speed from an element that doesn't exists
  20. what about the function that create the element and the functions that's get the speed?
  21. All of them because they work togother
×
×
  • Create New...