Jump to content

Dardex

Members
  • Posts

    22
  • Joined

  • Last visited

Everything posted by Dardex

  1. This is not the full code, Line 97- addCommandHandler("duty", duty) line 73- addCommandHandler("policeskin", policeSkins)
  2. Hey , can I have a hand here? Policeskin = createMarker ( 253.7255859375 , 77.0322265625 , 1003.640625 ,"cylinder", 2, 255, 255, 0, 90) setElementInterior (Policeskin, 6) setElementDimension (Policeskin, 1) function inDutySkin (hitPlayer,dimension) outputChatBox("Type /policeskin [1-6] to wear police clothes", source) addEventHandler("onMarkerHit",Policeskin,inDutySkin) function policeSkins(thePlayer, matchingDimension,cmdName,ID) policeman = getPlayerFromName(thePlayer) policemanTeam = getPlayerTeam(policeman) if isElementWithinMarker(thePlayer, Policeskin) then if (policemanTeam == "Police") then if cmdName == "policeskin" then if ID == "1" then setElementModel(thePlayer, 280) outputChatBox("You've chosen some police clothes.", thePlayer, 255, 0, 0) elseif cmdName == "policeskin" then if ID == "2" then setElementModel(thePlayer, 281) outputChatBox("You've chosen some police clothes.", thePlayer, 255, 0, 0) elseif cmdName == "policeskin" then if ID == "3" then setElementModel(thePlayer, 282) outputChatBox("You've chosen some police clothes.", thePlayer, 255, 0, 0) elseif cmdName == "policeskin" then if ID == "4" then setElementModel(thePlayer, 283) outputChatBox("You've chosen some police clothes.", thePlayer, 255, 0, 0) elseif cmdName == "policeskin" then if ID == "5" then setElementModel(thePlayer, 284) outputChatBox("You've chosen some police clothes.", thePlayer, 255, 0, 0) elseif cmdName == "policeskin" then if ID == "6" then setElementModel(thePlayer, 288) outputChatBox("You've chosen some police clothes.", thePlayer, 255, 0, 0) else outputChatBox("You are not a police,(( Open forum to applicate for Police job.))", thePlayer, 255, 0, 0) end end end end end end end end end end end addCommandHandler("policeskin", policeSkins) Policeduty = createMarker ( 230.9375 , 79.0517578125 , 1006.0390625 ,"cylinder", 2, 255, 255, 0, 90) setElementInterior (Policeduty, 6) setElementDimension (Policeduty, 1) function inDutyTell (hitPlayer,dimension) outputChatBox("Type /duty to start the police job.", source) addEventHandler("onMarkerHit",Policeduty,inDutyTell) function duty(thePlayer,matchingDimension) policeman = getPlayerFromName(thePlayer) policemanTeam = getPlayerTeam(policeman) if isElementWithinMarker(thePlayer, Policeskin) then if (policemanTeam == "Police") then if (getElementModel(thePlayer) == 280 or getElementModel(thePlayer) == 281 or getElementModel(thePlayer) == 282 or getElementModel(thePlayer) == 283 or getElementModel(thePlayer) == 284 or getElementModel(thePlayer) == 288) then outputChatBox("You're now in duty as a police.", thePlayer, 255, 0, 0) else outputChatBox("You have to wear police clothes first", thePlayer, 255, 0, 0) end end end end end addCommandHandler("duty", duty) Error:Warning: /server.lua:73: Bad argument @ `addCommandHandler` [Expected function at arguemnt 2, got nil] Warning: /server.lua:97: Bad argument @ `addCommandHandler` [Expected function at arguemnt 2, got nil]
  3. Hey. I wanted to create a marker in interior and in another dimension but, in wiki this is the command line marker createMarker ( float x, float y, float z [, string theType = "checkpoint", float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255, visibleTo = getRootElement( ) ] ) how do I add it in interior or dimensio?
  4. Alright thanks for help guys
  5. {1177.5682373047,-1323.2587890625,14.077121734619,-2584.6865234375,568.95703125,40.101623535156,-2654.5205078125,638.2412109375 , 14.453125} may I know why are there more than 1 location coordinates here?
  6. Thanks it works , now i have to find out how to add more hospitals gotta try since im new at scripting
  7. createBlip(1177.5682373047,-1323.2587890625,14.077121734619,22,root) createBlip(1607.1494140625,1819.6416015625,10.828001022339,22,root) createBlip(-2654.5205078125,638.2412109375,14.453125,22,root) local spawn_locations = { {1177.5682373047,-1323.2587890625,14.077121734619}, {1607.1494140625,1819.6416015625 ,10.828001022339}, {-2654.5205078125,638.2412109375,14.453125} } addEventHandler("onPlayerWasted",root,function() local list = {} local x,y,z = getElementPosition(source) for _,location in ipairs (spawn_locations) do local dist = getDistanceBetweenPoints3D(x,y,z,location[1],location[2],location[3]) list[dist] = location end table.sort(list) setTimer(spawnPlayer,1500,1,source,list[1][1],list[1][2],list[1][3]) end) this looks easier for me, but how do I add camera matrix here too?
  8. am not good at loops any link with instructions?
  9. Hey. Here i created some onPlayerWasted spawn location but there is an error, when I die in SF it spawns me in SF, same for LS but when I die in LV it spawns me again in LS can you find whats wrong here? PS:Is there any way to type if ( xx1 > xx2 ) and ( xx2 > xx3 ) then .... ,or something like that when I want to compare 3 elements in same if else createBlip ( 1177.5682373047, -1323.2587890625, 14.077121734619 , 22,getRootElement()) createBlip ( 1607.1494140625 , 1819.6416015625 , 10.828001022339 , 22,getRootElement()) createBlip ( -2654.5205078125 , 638.2412109375 , 14.453125 , 22,getRootElement()) addEventHandler( "onPlayerWasted", getRootElement( ), function() local x,y,z = getElementPosition (source) local sf = getDistanceBetweenPoints3D (x,y,z,-2654.5205078125 , 638.2412109375 , 14.453125) local lv = getDistanceBetweenPoints3D (x,y,z,1607.1494140625 , 1819.6416015625 , 10.828001022339) local ls = getDistanceBetweenPoints3D (x,y,z,1177.5682373047, -1323.2587890625, 14.077121734619) if (ls < sf) then setTimer( spawnPlayer, 15000, 1, source, 1177.5682373047, -1323.2587890625, 14.077121734619 ) setTimer( setCameraMatrix, 5000,1, source, 1208.8115234375 , -1287.755859375 , 38.246742248535 ,1177.5682373047, -1323.2587890625, 14.077121734619,0,70 ) elseif (lv < ls) then setTimer( spawnPlayer, 15000, 1, source, 1607.1494140625 , 1819.6416015625 , 10.828001022339 ) setTimer( setCameraMatrix, 5000,1, source, 1581.2802734375 , 1853.708984375 , 30.209064483643,1607.1494140625 , 1819.6416015625 , 10.828001022339,0,70 ) elseif (lv < sf) then setTimer( spawnPlayer, 15000, 1, source, 1607.1494140625 , 1819.6416015625 , 10.828001022339 ) setTimer( setCameraMatrix, 5000,1, source, 1581.2802734375 , 1853.708984375 , 30.209064483643,1607.1494140625 , 1819.6416015625 , 10.828001022339,0,70 ) elseif (sf < lv) then setTimer( spawnPlayer, 15000, 1, source, -2654.5205078125 , 638.2412109375 , 14.453125 ) setTimer( setCameraMatrix, 5000,1, source, -2584.6865234375 , 568.95703125 , 40.101623535156,-2654.5205078125 , 638.2412109375 , 14.453125,0,70 ) end end ) addEventHandler("onPlayerWasted",getRootElement(), function() setTimer( setCameraTarget, 15000,1, source, source,source ) end )
  10. Nvm worked ty SolidSnake/JR10
  11. should I add this on registration function?
  12. Hello! How can I block people who use color codes on their name when they want to register on server? function RegisterHandler ( player, username, password) local acc = addAccount(username,password) if acc then logIn(player,acc,password) outputChatBox("You've been successfully registred!",player,0,125,0) triggerClientEvent ( "CloseShit", getRootElement()) else outputChatBox("Hint:Do not use name colorcodes",player,125,0,0) outputChatBox("Username is already taken.",player,125,0,0) end end addEvent( "RegisterSubmit", true ) addEventHandler( "RegisterSubmit", getRootElement(), RegisterHandler ) this is registration function
  13. policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true }; addEventHandler ( 'onVehicleStartEnter', root, function( player ) if policeVehicles[ getElementModel( source ) ] and not getTeamName( getPlayerTeam ( player ) ) == 'Police' then cancelEvent() end end end ) i did this but look what it says: ')' expected (to close '(' at line 3) near 'end'
  14. policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true }; addEventHandler ( 'onVehicleStartEnter', root function( player ) if policeVehicles[ getElementModel( source ) ] and not getTeamName( getPlayerTeam ( player ) ) == 'Police' then cancelEvent() end end end ) Can you fix this
  15. policeVehicles = { [598]=true,[596]=true,[597]=true,[599]=true }; addEventHandler ( 'onVehicleStartEnter', root ) function( player ) if policeVehicles[ getElementModel( source ) ] and not getTeamName( getPlayerTeam ( player ) ) == 'POLICE' then cancelEvent() end end end ) forgot to close addEventHandler but now it says "" expected near "(" and script failed to start
  16. Sorry i mean for teams I created Police team.And if it is possible that police cars can be usable only from Police team.
  17. Prestage if i want it only for groups not for skin is it possible
  18. I know you too but not place to talk
  19. Hey guys I would like to ask if there is any script that allows only cops to enter in Police cars, if not is there any way to create it.
  20. Hi guys I'm new at scripting but I know a lot of it.I have a script called superman that allows players to fly but i would like that script to be usable only from admins/supermoderators not from everyone. local Superman = {} -- Static global values local rootElement = getRootElement() local thisResource = getThisResource() -- Resource events addEvent("superman:start", true) addEvent("superman:stop", true) -- -- Start/stop functions -- function Superman.Start() local self = Superman addEventHandler("superman:start", rootElement, self.clientStart) addEventHandler("superman:stop", rootElement, self.clientStop) end addEventHandler("onResourceStart", getResourceRootElement(thisResource), Superman.Start, false) function Superman.clientStart() setElementData(client, "superman:flying", true) end function Superman.clientStop() setElementData(client, "superman:flying", false) end
×
×
  • Create New...