Awang

Members
  • Content count

    41
  • Joined

  • Last visited

Community Reputation

8 Neutral

1 Follower

About Awang

  • Rank
    Rat

Details

  • Location
    Hungary
  • Interests
    Lua, HTML5, CSS3, JQuery, PHP
  1. What will affect performance the most?

    With these instructions, I think, if you calculate in client side, you should only calculate peds, which are in the streamed zone. Use an if branching with isElementStreamedIn(), or if you really want to reduce the peds table, you should use "onClientElementStreamedIn" and "onClientElementStreamedOut" events and a table, where you push and remove the peds. Good to know, that if you restart the resource while you have peds already in the srteamed zone, they will not trigger this event, so you need to loop peds table with getElementsByType("ped",root,true), where the last param choose you only the streamed peds, then you can add to the table. Anyway, making AIs in Mta is very interesting, have a good luck with this!
  2. onClientPlayerQuit is not working!

    Because this event can't use detect if the player quit and this player is himself... This event can use to detect other clients quite in client side... With onClientResourceStop () you can do it, if you want to push the local data to serverside, in this case: --- Client side items = {1,2} function saveItems() triggerServerEvent ("listItems", localPlayer, items) end addEventHandler ("onClientResourceStop", resourceRoot, saveItems) Serverside should be good, but I have doubt about get the player name... Anyway, you can read all of these usefull advice in wiki, It's good to use it... You can read also great examples and I'ts always uptodate.
  3. Teams and markers

    Or in clientside: addEventHandler("onClientMarkerHit",theMarker,function(hitPlayer, matchingDimension) if matchingDimension and hitPlayer == localPlayer then if getPlayerTeam(localPlayer) == team1 then outputChatbox("You are in team 1") elseif getPlayerTeam(localPlayer) == team2 then outputChatbox("You are in team 2") elseif getPlayerTeam(localPlayer) == false then outputChatbox("You are not member of any team") end end end)
  4. [Question] Reduce the damage

    You shuld check this by matematically... For example, the loss is 10, 10/50 will not the 50% of 10.... if you really want to do with percent parameter, you need to use like this: local reductionPercent = 50 addEventHandler('onClientPlayerDamage',root,function(attacker,weapon,bodypart,loss) if loss then local health = getElementHealth(localplayer) setElementHealth(localplayer,health+(loss*(reductionPercent/100)) end end) Still I think, cancel the root damage and recalculate it will be the simpliest way to understand how this event work... Even the question was reduce the damage for a specific player, not for everbody... With elementData you can change it real time in the server, like an admin can take this ability or give it to a player by using setElementData()
  5. [Question] Reduce the damage

    Or if you add a specific elementData, you can write something like this: addEventHandler("onClientPlayerDamage",root,function(attacker, weapon, bodypart,loss) if source == localPlayer and getElementData(localPlayer,"less.damage") == true then cancelEvent() setElementHealt(localPlayer,getElementHealt(localPlayer)-loss*0.8) end end) For the player, who have the elementData will only get the 80% of the real damage.
  6. destroyElement

    Your way, but you need to use client side, or maybe an assoc server table with the car elements ( where the table keys can be the player name) , but I don't really suggest that... Just a little communication between the client and server...
  7. destroyElement

    You can't use only serverside for that problem if you want to delete only the clien's car on the client death... Try the code, what I'm wrote...
  8. destroyElement

    You should use not only server side... I don't know well, what you want to make, but here is, how I understand your problem: Make a marker for all: Server side: car_marker = createMarker( 0,0,0 , "checkpoint",4,0,0,255,255) setElementData(car_marker,"type","car") You can check the hit on client side: addEventHandler ( "onClientMarkerHit", getRootElement(), function() if getElementData(source,"type") == "car" then local x,y,z = getElementPosition(getLocalPlayer()) triggerServerEvent("createVeh",root,getLocalPlayer(),x,y,z) end end) Now create veh on Server: addEvent("createVeh",true) addEventHandler("createVeh",getRootElement(),function(player,x,y,z) local veh = createVehicle ( 432,x+10,y+10,z+3) triggerClientEvent(player,"synMyVeh",player,veh) end) Receive and save the car element on client and write a death handler: addEvent("synMyVeh",true) local myCar = nil addEventHandler("synMyVeh",root,function(veh) myCar = veh end) addEventHandler("onClientPlayerWasted",root,function() triggerServerEvent("deleteMyVeh",root,myCar) end) And delete only the client car in server side(maybe you can solve this in client side, not tested) addEvent("deleteMyVeh",true) addEventHandler("deleteMyVeh",getRootElement(),function(vehicle) destroyElement(vehicle) end) All the code not tested....
  9. Auto copy command

    Copy to the client clipboard, or send an outputChatBox() with the link? Becuse in this way, you need a trigger for the client: Server side: addEventHandler("onPlayerCommand",getRootElement(),function(command) if command == "facebook" then triggerClientEvent(source,"copyTheLink",source,"www.facebook.com") end end) Client side: addEvent("copyTheLink",true) addEventHandler("copyTheLink",root,function(link) setClipboard(link) end) Or just for \facebook you can do it only in client side: addCommandHandler("facebook",function() setClipboard("www.facebook.com") end)
  10. Auto copy command

    You mean, when player use a Command, send a massege to client with the command like this? addEventHandler("onPlayerCommand",getRootElement(),function(command) outputChatBox("You used this command: "..command,source) end)
  11. triggerServerEvent

    If you want to ignore the Event what triggered from other resource, you just not write a Handler for it. But if you want to stop/kill you can use: cancelEvent()
  12. bug with CJ extra clothes

    Do you change CJ's body elementAlpha? Anyway, you can correct it by manuelly, using shader on body and load this picture on it.
  13. Grid list and buttons background

    guiSetAlpha ( element guielement, float alpha ) You only can hide the whole element. Maybe you should use static images and labels...
  14. Player animation

  15. I have the same problem. This problem is caused because the conversation use too much custom objects (around 1500). @CodyJ(L) mentioned, that he will appear a map editor, which will can handle these objects. So much people are waiting for it with interest