Jump to content

Ludo

Members
  • Posts

    66
  • Joined

  • Last visited

Everything posted by Ludo

  1. Ludo

    Help..

    function enterWaterfish() local playerSkin = getElementModel(source) if playerSkin == 45 then if isElementInWater(source) then setElementHealth(source, 100) end end end addEventHandler("onPlayerDamage", getRootElement(), enterWaterfish) This should work
  2. Ludo

    [Tables]

    You are welcome Good luck with your gamemode!
  3. Ludo

    [Tables]

    localID = { {1.30,1.22,5,20,"<<<-"}, {2.90,1.22,5,20,"->>>"}, {1.80,1.22,5,20,"Ready!"} } You have to put a "," after a row of a table. Anyway you must use {} to define a table with multiple values, as you can get it with double table pointer: for i, value in ipairs(localID) do guiCreateButton(localID[value][1], localID[value][2], localID[value][3], localID[value][4], localID[value][5], false) -- I copied Mr.Pres[T]ege's post values, but you can edit them end
  4. This function shows the blips of alive players TO alive players and blips of in-training players TO in-training players rotationRotator = 0 addEventHandler("onClientHUDRender", getRootElement(), function() showPlayerHudComponent("radar", false) local px, py, pz = getElementPosition(localPlayer) local pr = getPedRotation(localPlayer) local cx,cy,_,tx,ty = getCameraMatrix() local north = findRotation(cx,cy,tx,ty) dxDrawImage(posx,posy,height,height, "img/radar.png") dxDrawImage(posx,posy,height,height, "img/north.png", north) for id, player in ipairs(getElementsByType("player")) do local veh = getPedOccupiedVehicle(player) local dimension = getElementDimension(player) if getElementData(player, "state") == getElementData(localPlayer, "state") then if player ~= localPlayer then local _,_,rot = getElementRotation(veh) local ex, ey, ez = getElementPosition(veh) local dist = getDistanceBetweenPoints2D(px,py,ex,ey) if dist > range then dist = tonumber(range) end local angle = 180-north + findRotation(px,py,ex,ey) local cblipx, cblipy = getDistanceRotation(0, 0, height*(dist/range)/2, angle) local blipx = centerleft+cblipx-blipsize/2 local blipy = centertop+cblipy-blipsize/2 local yoff = 0 local r,g,b,a = 255,255,255,255 if getPlayerTeam(player) then r,g,b = getTeamColor( getPlayerTeam(player) ) end local img = "img/blip.png" if (ez - pz) >= 5 then img = "img/blipup.png" elseif (ez - pz) <= -5 then img = "img/blipdown.png" end if tonumber(getElementModel(veh)) == 425 then img = "img/hunter.png" end dxDrawImage(blipx, blipy, blipsize, blipsize, img, north-rot+45, 0, 0, tocolor(r,g,b,a)) if img == "img/hunter.png" then rotationRotator = rotationRotator + 1.25 dxDrawImage(blipx, blipy, blipsize, blipsize, "img/rotor.png", north-rot+45+rotationRotator, 0, 0) end end end local vehicle = getPedOccupiedVehicle(localPlayer) dxDrawImage(centerleft - lpsize/2, centertop - lpsize/2, lpsize,lpsize, "img/local.png", north-pr,0,0,tocolor(255,255,255,255)) end end )
  5. Ludo

    Table .

    Where to you define that "Ped" (in the "if" line)?
  6. has no errors but the beeps(blips) of players who are in training appears to them that are with state alive Of course, because here in line 65 you put: if getElementData(localPlayer, "state") == "alive" or getElementData(localPlayer, "state") == "Training" and veh and dimension and player ~= localPlayer then that creates the blips for both in-training and alive player, so you just have to replace it with: if getElementData(localPlayer, "state") == "alive" and veh and dimension and player ~= localPlayer then
  7. This only cancels /nick But how to cancel changing from settings should I cancel onClientPlayerChangeNick ? Man, changing the nick from "settings" or using /nick command should be the same, as you change your nick and then send it to the server, so you can use onPlayerChangeNick and then cancel the event, you won't have any problem.
  8. Ludo

    arrest ?

    What do you mean with "arreste" (i think you misspelled, you mean "arrest")? Anyway if you mean "stop the player" then you can use setElementVelocity Exactly that's what i'm looking for thanks man . You're welcome
  9. Can you please tell us what does your /debugscript 3 say?
  10. Ludo

    arrest ?

    What do you mean with "arreste" (i think you misspelled, you mean "arrest")? Anyway if you mean "stop the player" then you can use setElementVelocity
  11. That' s because you first set Health and Armor and THEN spawn the player. Opposite thing should be made. Try this, it should work. function playerstats(nick) -- nick is from client where player wrote his login base= mysql_connect("x", "x", "x", "x") getPlayerData= mysql_query(base, "SELECT * FROM players WHERE Nick='".. nick .."'") table= mysql_fetch_assoc(getPlayerData) local player = getPlayerFromName(table.Nick) setPlayerMoney(player, table.Money) local team = getTeamFromName(table.Team) setPlayerTeam (player, team ) spawnPlayer( player, 2930.6001, -2042, 3.5 ) fadeCamera( player, true ) setCameraTarget( player, player) setElementHealth(player, table.Health) setPedArmor(player, table.Armour) mysql_free_result(getPlayerData) end
  12. That's because the source of that event is the root element, so you aren't gonna get the resource that outputs the message.
  13. That won't work, as the wiki says "This event is triggered when a player chats inside the chat box." So it won't work for resources' messages
  14. Not tested: function preventSpam(message, element) if not (getElementType(element) == "player") then cancelEvent() end end addEventHandler("onChatMessage", getRootElement(), preventSpam)
  15. I think it isn't at all, anyway try it and let me know
  16. At the end, try "onClientGUIClick" instead of "onClientClick", because (wiki): "This event triggers whenever the user clicks his mouse. This is linked to the GTA world, as oppose to GUI for which onClientGUIClick is to be used. This event allows detection of click positions of the 3D world."
  17. This will check is the vehicle that hits the marker is being towed and if it is a bullet. function checkIfTowed(element) if getElementType(element) == "vehicle" then if getVehicleTowingVehicle(element) then if getElementModel(element) == 525 then --your function end end end end addEventHandler("onMarkerHit", getRootElement(), checkIfTowed) EDIT: I used a wrong event, this one should work
  18. vehicle = getVehicleTowingVehicle(yourVehicle) if getElementModel(vehicle) == 525 then --your function end What is meant to be under "yourVehicle"? Man, what do you want to do with your script? I didn't get it.
  19. vehicle = getVehicleTowingVehicle(yourVehicle) if getElementModel(vehicle) == 525 then --your function end
  20. Ludo

    math.random

    That will create a vehicle for each line in the table, so if you want the creation of just 1 vehicle you should do something like this: --x, y, z, model spawns = { {200, 200, 34, 522}, {400, 300, 25, 411}, {567, 235, 56, 567} } function whatEver() rLine = math.random(1, #spawns) createVehicle(spawns[rLine][1], spawns[rLine][2], spawns[rLine][3], spawns[rLine][4]) end --Remember to call the function C:
  21. You can't just do that. Because that you need has to be triggered with "onPedWeaponSwitch", but if someone switches his weapon to a non-allowed one, then the glitch will be disabled for ALL THE PLAYERS, also for ones who have an allowed weapon, because setGlitchEnabled is a server-side function.
  22. Man I think you could do this also with some trigger between client and server, but if someone copies this resource and decompiles it, these code lines can be easily removed so this kind of security will be totally useless.
×
×
  • Create New...