Jump to content

Emanuel

Members
  • Posts

    18
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Emanuel's Achievements

Square

Square (6/54)

0

Reputation

  1. Good day. My question is: If two players call a server script at the exact same time, will one be ignored?
  2. It is working, at least the decreasing part is. The bug now is that the wanted level goes up by 2, but I think I can fix it now. Thanks Ayush!
  3. I will try to explain my idea using a scheme. A person commits a crime that gives a wanted level of 5. Start timer to decrease his wanted level to 0. If there is a timer, destroy it, and start a new one. (Here is the problem. Since it is creating multiple ones, the wanted level goes to zero quickly because each timer is decreasing it.) In each time step, wanted level = wanted level - 1 When the wanted level becomes 0, destroy the timer.
  4. It didn't work. It still creates a timer each time I call the function, but doesn't destroy the previous one.
  5. Good day! This is my code where the objective is to set the player wanted level. After increasing the wanted level, I want to create a timer in order to start decreasing it. The problem is that in my code, at each wanted level increase, it creates a timer, which is pretty annoying. The thing is, how can I check if there is a timer and destroy it, before starting the new one? I thought I did that, but the code is not working! function setWantedLevel(player) local wantedLevel = getElementData(player,"wantedLevel") if wantedLevel == 10 then setElementData(player,"wantedLevel",10,true) exports.SASCnotifications:drawNotification("#FF0000[Wanted Level System]#FFFFFF Wanted level is "..wantedLevel..".",localPlayer) else setElementData(player,"wantedLevel",wantedLevel+1,true) exports.SASCnotifications:drawNotification("#FF0000[Wanted Level System]#FFFFFF Wanted level increased to "..(wantedLevel+1)..".",localPlayer) if getElementData(player,"wantedLevel") == 3 then triggerServerEvent("setCriminalJob",player,player) end end timer = nil timer = setTimer(function(myTimer) if isTimer(myTimer) then killTimer(myTimer) timer=nil end local wantedLevel = getElementData(player,"wantedLevel") if wantedLevel == 0 then killTimer(myTimer) elseif wantedLevel ~= 0 then setElementData(player,"wantedLevel",wantedLevel-1,true) exports.SASCnotifications:drawNotification("#FF0000[Wanted Level System]#FFFFFF Wanted level decreased to "..(wantedLevel-1)..".",player) end end,5000,0,timer) end
  6. Hello ! I have a question about encryption. Is there any way of securing our scripts automatically ? Something like adding a file to the resource, and the files will become encrypted. I know that it is related with this https://luac.multitheftauto.com/api/, but I don't know how to use it. If someone could help me, I would appreciate ! Emanuel Camacho
  7. Ora muito obrigado pela resposta esclarecedora que estava à espera !!! Só tenho mais uma questão. Será que me poderia explicar a linha 65 e 66 do seu código ? É só para perceber mais profundamente essas condições. Muito agradecido, Emanuel
  8. Está aqui o link, que eu pedi ajuda, mas parece que ninguém quer ajudar, por isso venho aqui pedir a vossa ! Também quero pedir que alguém me esclareça qual a diferença entre resourceRoot, root,getElementRoot() e essas coisas, pois estou muito confuso, e penso que o problema neste script, é por causa disso. EDIT : Já tentei passar o script todo para client side. https://forum.multitheftauto.com/viewtopic.php?f=91&t=90395 Ficaria muito agradecido com uma resposta esclarecedora Emanuel Camacho
  9. Hello ! I need you help in this script. First of all, I am not a good scripter, that's why I am asking you why this is not working properly. When two players are playing, one can steal bus stops from other. Also, when one leaves his bus, the other one will not see the markers. Can you help me, and explain everything as I was the dumbest person in the world ? -----------------------------------------------<< -- MTA : Multi Theft Auto : Emanuel's Server -- Date: 21 July 2015 -- Resource: [MTA][Jobs]/[MTA]BusDriver/server.lua -- Type: Server Side -- Author: Emanuel Camacho -----------------------------------------------<< local busses = {[431] = true, [437] = true} local rootElement = getRootElement() local markers = { [1] = {-1798.63940, 83.94303, 15.10938}, [2] = {-1800.16284, 102.19742, 15.10938}, [3] = {-1800.60095, 126.91389, 15.10938}, } function getNewBusLocation( thePlayer, ID ) local x, y, z = markers[ID][1], markers[ID][2], markers[ID][3] triggerClientEvent(thePlayer,"setNextBusStopPosition",thePlayer,x,y,z) end function onVehicleEnter(client) if not busses[getElementModel(source)] then return end if not getPlayerTeam(client) then return end if getTeamName(getPlayerTeam(client)) == "Bus Driver" then local x, y, z = getNewBusLocation(client, 1) setElementData(client,"busData",1) end end addEventHandler("onVehicleEnter",rootElement,onVehicleEnter) addEvent("updateBusStop",true) addEventHandler("updateBusStop",rootElement, function (client) if not isPedInVehicle(client) then return end if not busses[getElementModel(getPedOccupiedVehicle(client))] then return end givePlayerMoney(client, 100) if #markers == tonumber(getElementData(client,"busData")) then setElementData(client,"busData",1) else setElementData(client,"busData",tonumber(getElementData(client,"busData"))+1) end getNewBusLocation(client, tonumber(getElementData(client,"busData"))) end) -----------------------------------------------<< -- MTA : Multi Theft Auto : Emanuel's Server -- Date: 21 July 2015 -- Resource: [MTA][Jobs]/[MTA]BusDriver/client.lua -- Type: Client Side -- Author: Emanuel Camacho -----------------------------------------------<< local client = getLocalPlayer( ) local rootElement = getRootElement() local marker = nil local blip = nil function createNextStop ( x, y, z ) marker = createMarker(tostring(x), tostring(y), tostring(z)-1, "cylinder", 3.5, 255, 255, 0, 170) blip = createBlipAttachedTo( marker, 0, 2, 255, 255, 0, 255 ) addEventHandler("onClientMarkerHit",marker,onBusStopHit) end addEvent("setNextBusStopPosition",true) addEventHandler("setNextBusStopPosition", rootElement, createNextStop ) function onBusStopHit( hitPlayer ) if not hitPlayer == localPlayer then return end triggerServerEvent("updateBusStop",localPlayer,localPlayer) if isElement(blip) then destroyElement(blip) end if isElement(marker) then removeEventHandler("onClientMarkerHit",marker,onBusStopHit) destroyElement(marker) end end function leavingVehicle() if isElement(marker) then removeEventHandler("onClientMarkerHit",marker,onBusStopHit) destroyElement(marker) end if isElement(blip) then destroyElement(blip) end end addEventHandler("onClientVehicleExit",rootElement, leavingVehicle )
  10. Do you even know how noob I am in this ? lol .I really need help in this PS : Someone said that I could use triggerServerEvent("eventName", root, theResultOfFunction) Any suggestion ? NOTE : It is something like this. It is set on a determinated position, not attacked to a player, or a car.
  11. This isn't working Do you even know how noob I am in this ? lol .I really need help in this PS : Someone said that I could use triggerServerEvent("eventName", root, theResultOfFunction) Any suggestion ?
  12. First of all, I am a beginner in this gigantic world, and sorry for my ignorance. I have some bugs, that I want to be solved. Bugs: - The project is not synchronized. Each player gets attacked by his own turret, and not from the one I have created. - When I use the command /turret it creates one on me, and other players have one on their head. For example, if anyone uses /turret, I will have a turret on me, which doesn't make sence. Here is the project : Client : function turret() x, y, z = getElementPosition(getLocalPlayer()) weapon = createWeapon("m4", x, y, z+1.5) setWeaponClipAmmo ( weapon,99999) setWeaponState ( weapon,"firing") setWeaponTarget ( weapon, true ) setWeaponTarget ( weapon ,getLocalPlayer(), 255 ) end addEvent("turret", true) addEventHandler("turret", root, turret) function destroy() destroyElement (weapon) end addEvent("destroy", true) addEventHandler("destroy", root, destroy) Server : function turret() triggerClientEvent(root, "turret", root, x, y, z) end addCommandHandler("turret", turret) function destroy() triggerClientEvent(root, "destroy", root, x, y, z) end addCommandHandler("end", destroy) Meta : <meta> <script src="client.lua" type="client" /> <script src="server.lua" type="server" /> <min_mta_version client="1.3.0-9.04555"></min_mta_version> </meta> I would appreciate if you could fix it. thanks.
  13. Hello, I have a question. Is possible to make admins the only ones who can use the map editor in their server. For example, if an admin starts the mapeditor resources, the other players can continue playing, and he is the only only editing ? If its not possible, can you give me a simple map editor, since I can't find any ... Thanks in advance !
  14. a51_labglass this is it,. What to do with it ? EDIT : Ok, the problem is resolved. The code was : <removeWorldObject id="removeWorldObject (object) (1)" radius="100" interior="0" model="16655" lodModel="0" posX="280.3281" posY="1874.234" posZ="7.75" rotX="0" rotY="0" rotZ="0"></removeWorldObject>
  15. I have a doubt. I was making a map, in the area 51, and I decided to delete the lab glasses (on the underground part). The problem is that it can't be selected, and I can't erase it. Any suggestions ? As I know, that this is the code to delete an object ... <removeWorldObject id="removeWorldObject (a51_sdsk_3_) (1)" radius="4.282804" interior="0" model="3395" lodModel="0" posX="280.3281" posY="1874.234" posZ="7.75" rotX="0" rotY="0" rotZ="0"></removeWorldObject> I tryed to use this one : <removeWorldObject id="removeWorldObject (a51_labglass) (1)" </removeWorldObject> But it didn't work.
×
×
  • Create New...