Jump to content

Awang

Members
  • Posts

    65
  • Joined

  • Last visited

Everything posted by Awang

  1. 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.
  2. 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)
  3. 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()
  4. 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.
  5. 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...
  6. 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...
  7. 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....
  8. 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)
  9. 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)
  10. 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()
  11. Do you change CJ's body elementAlpha? Anyway, you can correct it by manuelly, using shader on body and load this picture on it.
  12. guiSetAlpha ( element guielement, float alpha ) You only can hide the whole element. Maybe you should use static images and labels...
  13. 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
  14. Hello guys I want to make a clothe system which depend on, that we can change CJ's clothes txd. But, I want that players can use not only the CJ's original skin, I think there is an option with shaders, so I can change CJ's "skin" and make some another type, like European, Asian men/women. So the question is, has anyone shader for CJ's body, or any better idea, how can I make this possible? If I can, I don't want to use bone attached custom objects. Thank you for any answer!
  15. So first of all, arguments mean variables wich are attach to your event, what you triggered before. For example, you triggered "drawStuff" event, and you can attach a variable, then in function ( in client side drawstuff) you can use it. If you have any question, I can help you in PM in Hungary....
  16. Thank you @3aGl3, I guess I learned so much... If I will have done something, I will post it...
  17. Thank you @3aGl3! I also don't think, that I find a public one, but I interested, how it basicly work and how I can make my own one... I wonder, how shaders can apply in real time and how to change their position and size, as we could se in the video? I just learn how shaders are working...
  18. Hey guys, I have another question for you! I saw this video on the internet, but I haven't got any idea, how the creator did this custom vinyl system... I think he did some magice with shader, but I don't know Thank you for any asnwer guys!
  19. I mean yes, I loaded the .map file and then I started the resource, what load the custom objects, and import them into the editor with "import [resource]" command... But here the editor crashed...
  20. Hey guys, I have another question for you! I have a Liberty City map conversation ( what I made with the scene2res converter), so I have lots of custom objects. The problem is, when I want to load them into the editor, server warn me about "long execution in main_editor.lua", and the objects not loaded. Have you got any idea, what should I do, or if the editor script is not avaiable for this, what program is? Thank you for any answer!
  21. Okay, I have 2 Lua resource, ones contains dx functions, what I call in different res: function dxEditbox(xb,yb,wb,hb,name,types) local boxweb = guiCreateBrowser(xb,yb,wb,hb,true,true,false) local bboxweb = guiGetBrowser( boxweb ) addEventHandler("onClientBrowserCreated", bboxweb, function() loadBrowserURL(bboxweb, "http://mta/ts_dx_core/web/editbox.html") end ) addEventHandler ( "onClientBrowserDocumentReady" , bboxweb ,function () executeBrowserJavascript(bboxweb, "$(document).trigger('onEditBoxCall',['"..name.."','password']);" ) end) return boxweb end function dxGetEditbox(wbox,name) local asd = guiGetBrowser( wbox ) executeBrowserJavascript(asd, "$(document).trigger('onEditBoxGetValue');" ) return edittext end So, in a Login system, I want to call these functions. Because, it's work in progress, I just bind the dxGetEditbox function on a key: addEventHandler("onPasswordPanelCall",root,function() start = getTickCount() movex1,movex2 = movex2,-1500 setTimer(function() removeEventHandler("onClientClick",root,userchoose) removeEventHandler("onClientRender",root,loginpanel) addEventHandler("onClientRender",root,passwordpanel) movex1,movex2 = 1920,700 start = getTickCount() boxweb = exports['ts_dx_core']:dxEditbox(1920,550,300,150,"password","password") end,2000,1) end) bindKey("n","up",function() addEventHandler("onEditBoxValue",root,function(backtext) outputChatBox(backtext) end) exports['ts_dx_core']:dxGetEditbox(boxweb,"password") end)
  22. And a come back with a problem I can trigger "onEditBoxGetValue" in Js and it's handled, but mta.triggerEvent("onEditBoxValue"+eventName,text) doesn't do anything... I tried also just with mta.triggerEvent("onEditBoxValue"); but also not working
×
×
  • Create New...