Jump to content

Feher

Members
  • Posts

    11
  • Joined

  • Last visited

Recent Profile Visitors

734 profile views

Feher's Achievements

Square

Square (6/54)

0

Reputation

  1. Feher

    hi

    Hey, "onPlayerClick" is an existing Server-sided event, you have to find own event names for your events. --Client-side Button1 = guiCreateButton( 0.7, 0.3, 0.2, 0.1, "Outp11ut!", true ) function wuy() showCursor(true) end addCommandHandler("y",wuy) addEventHandler("onClientGUIClick",root,function () if (source == Button1) then triggerServerEvent ( "onPlayerClicko",localPlayer) end end) -- Server-side addEvent( "onPlayerClicko", true ) addEventHandler( "onPlayerClicko",root,function () if (getPlayerMoney(source) > 100) then setPedArmor(source,50) takePlayerMoney(source,100) else outputChatBox ("you poor",source,150,0,0) end end)
  2. Hey, You forgot an ")". In the 3rd line you call an eventhandler and you forgot to close it.
  3. yes, but I've added an extra if inside the function which checks if the clicked element is the button you created if (source == wa) then and yea, I don't know why did I use the marker word instead of the button thx for saying(edited)
  4. Hey, the problem with your script is that the wa variable doesn't exist when the addCommandHandler line gets executed, you can evade this like this: function ylay() wa = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "Output!", true ) showCursor(true) end function wia() if (source == wa) then --Checks if it is the button we are looking for or not destroyElement (wa) showCursor(false) end end addCommandHandler ( "y", ylay ) addEventHandler ("onClientGUIClick",root,wia) see?, I used root as the second argument of the eventhandler so we don't get any error, and checked inside the function if the wa variable is the button we are looking for or not by using source.
  5. Feher

    help marker

    Hey, try this function marker(player) local x, y, z = getElementPosition(player) markero = createMarker( x+5, y, z, "cylinder", 2, 255, 0, 0, 150, getRootElement()) setElementVisibleTo(markero, getRootElement(), false) setElementVisibleTo(markero, player, true) blip= createBlipAttachedTo(markero, 0, 2, 255, 0, 255, 255) end addCommandHandler("marker", marker) function markhit (element) if (source == markero) then destroyElement(markero) destroyElement(blip) end end addEventHandler("onMarkerHit", root, markhit)
  6. what I've made heals you +5 hp in every 3 secs after you get any damage, but you have to write an if statement with the medickit's weapon id, about while loop I am sure LUA has time/date function for that, but you should stick to the setTimer function because it's way more easier.
  7. Hey, this should work function medkit(attacker, weapon) --if weapon == (medkitid) then timer = setTimer(heal, 3000, 20, source) --end end addEventHandler ( "onPlayerDamage", root,medkit) function heal(player) health = getElementHealth (player) if (health < 100) then setElementHealth(player,health+5) else if (isTimer(timer)) then killTimer(timer) end end end
  8. Type /bindme first after you can use left shift button function fanFunction ( player) bindKey ( player, "lshift", "down", function (player) local vehicle = getPedOccupiedVehicle(player) local sx,sy,sz = getElementVelocity ( vehicle ) setElementVelocity( vehicle ,sx, sy, sz+0.5 ) end ) end addCommandHandler ( "bindme", fanFunction )
  9. Feher

    Help

    Hey, use the setTimer() and the isTimer() functions. You can find a list of functions at the wikipedia.
  10. Hey, use addCommandHandler instead of addEventHandler
×
×
  • Create New...