Jump to content

Walid

Members
  • Posts

    1,491
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Walid

  1. Put the dxDrawText inside "onClientRender" event and use setTimer to hide the player name.
  2. Server side not client side You can use onClientPlayerJoin
  3. function stats() setPedStat (source, 24, 1000) setElementHealth(source, 200) end addEventHandler("onPlayerJoin", root, stats) The source of this event is the player who joined.
  4. I already added it check my code anyways you are welcome.
  5. i'm pretty sure it's not your code anyways post full code here.
  6. Many things wrong in your code you can use sth like this -- client side function guiClicked(btn, state) if btn == "left" and state == "up" then if source == bCrim then triggerServerEvent("onClientTeamPicked", localPlayer, "Criminal", --[[put the skin id here]]) closePanel() elseif source == bEnf then triggerServerEvent("onClientTeamPicked", localPlayer, "Enforcer", --[[put the skin id here]]) closePanel() end end end addEventHandler("onClientGUIClick", resourceRoot, guiClicked) -- server side addEvent("onClientTeamPicked", true) addEventHandler("onClientTeamPicked", root, function(name,skin) if name and tonumber(skin) then local team = getTeamFromName(name) setPlayerTeam(source, team) setElementModel(source,tonumber(skin)) end end) And remove the giveTeam function.
  7. Replace (setPedElement with setElementModel) and (localPlayer with source)
  8. local restrictedTo = {[488]=true} function functionName() if isPedInVehicle(localPlayer) then local vehicle = getPedOccupiedVehicle (localPlayer) local model = getElementModel(vehicle) local seat = getPedOccupiedVehicleSeat(localPlayer) if (restrictedTo[model] and seat ~= 0) then local x,y,z = getElementPosition(localPlayer) createProjectile(localPlayer, 19, x, y, z + 2, 1, nil, nil, nil, nil, -1, -1, -1, 0) end end end bindKey ("o", "down",functionName)
  9. Lol it's a client side code check your meta.xml file (working fine for me).
  10. function antiSpamRPG(weapon) if isTimer(cdTimer) then return end if (weapon == 35) then toggleControl("aim_weapon", false) toggleControl("fire", false) cdTimer = setTimer( function() toggleControl("aim_weapon", true) toggleControl("fire", true) end, 7000, 1 ) end end addEventHandler("onClientPlayerWeaponFire",localPlayer, antiSpamRPG)
  11. Added this line client side. guiSetInputMode("no_binds_when_editing")
  12. Walid

    Admin logo

    local tag = dxCreateTexture("Duty/Fejleszto_Duty.png") local tag2 = dxCreateTexture("Duty/Tulajdonos_Duty.png") function Fejleszto_Duty() local players = getElementsByType("player") for i = 1 , #players do local adminduty = getElementData(players[i], "adminduty") or 0 local alpha = getElementAlpha(players[i]) or 0 if tonumber(adminduty) == 1 and alpha == 255 then if players[i] ~= localPlayer then if exports.StarMTA_core:Fejleszto(players[i]) then dxDrawImageOnElement(players[i],tag) elseif exports.StarMTA_core:Tulajdonos(players[i]) then dxDrawImageOnElement(players[i],tag2) end end end end end addEventHandler("onClientRender", root, Fejleszto_Duty) function dxDrawImageOnElement(TheElement,Image,distance,height,width,R,G,B,alpha) local x, y, z = getElementPosition(TheElement) local x2, y2, z2 = getElementPosition(localPlayer) local distance = distance or 20 local height = height or 1 local width = width or 1 local checkBuildings = checkBuildings or true local checkVehicles = checkVehicles or false local checkPeds = checkPeds or false local checkObjects = checkObjects or true local checkDummies = checkDummies or true local seeThroughStuff = seeThroughStuff or false local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false local ignoredElement = ignoredElement or nil if (isLineOfSightClear(x, y, z, x2, y2, z2, checkBuildings, checkVehicles, checkPeds , checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then local sx, sy = getScreenFromWorldPosition(x, y, z+height) if(sx) and (sy) then local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distanceBetweenPoints < distance) then dxDrawMaterialLine3D(x, y, z+1+height-(distanceBetweenPoints/distance), x, y, z+height, Image, width-(distanceBetweenPoints/distance), tocolor(R or 255, G or 255, B or 255, alpha or 255)) end end end end
  13. Walid

    Admin logo

    if players[i] ~= localPlayer then end
  14. Try this local motelOutside = createMarker( 2333.5, -1943.5, 15, "cylinder", 1, 255, 255, 0, 170 ) local motelInside = createMarker( 2215, -1150.5, 1025, "cylinder", 1, 255, 255, 0, 170 ) setElementInterior(motelInside, 15) function motel(player) if player and isElement(player) and getElementType(player) == "player" and not isPedInVehicle(player) then if (source == motelOutside) then setElementInterior(player, 15, 2216,-1150.5,1025) setElementFrozen(player,true) setTimer(setElementFrozen, 1000, 1, player, false) elseif (source == motelInside) then setElementInterior(player, 0, 2335, -1943.5, 15) setElementFrozen(player,true) setTimer(setElementFrozen, 1000, 1, player, false) end end end addEventHandler("onMarkerHit", root, motel)
  15. Walid

    Admin logo

    Try this local tag = dxCreateTexture("Duty/Fejleszto_Duty.png") function Fejleszto_Duty() local players = getElementsByType("player") for i = 1 , #players do if getElementData(players[i], "adminduty") then dxDrawImageOnElement(players[i],tag) end end end addEventHandler("onClientPreRender", root, Fejleszto_Duty) function dxDrawImageOnElement(TheElement,Image,distance,height,width,R,G,B,alpha) local x, y, z = getElementPosition(TheElement) local x2, y2, z2 = getElementPosition(localPlayer) local distance = distance or 20 local height = height or 1 local width = width or 1 local checkBuildings = checkBuildings or true local checkVehicles = checkVehicles or false local checkPeds = checkPeds or false local checkObjects = checkObjects or true local checkDummies = checkDummies or true local seeThroughStuff = seeThroughStuff or false local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false local ignoredElement = ignoredElement or nil if (isLineOfSightClear(x, y, z, x2, y2, z2, checkBuildings, checkVehicles, checkPeds , checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then local sx, sy = getScreenFromWorldPosition(x, y, z+height) if(sx) and (sy) then local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distanceBetweenPoints < distance) then dxDrawMaterialLine3D(x, y, z+1+height-(distanceBetweenPoints/distance), x, y, z+height, Image, width-(distanceBetweenPoints/distance), tocolor(R or 255, G or 255, B or 255, alpha or 255)) end end end end
  16. Walid

    Admin logo

    All what you need : dxDrawImageOnElement
  17. Walid

    help

    Try this: (untested) function redpoint(player) local marker = createMarker( 842.9404296875, -1859.5, 12.8671875, "cylinder", 2, 255, 0, 0, 255) local blip = createBlipAttachedTo(marker, 0, 4, 255, 0, 0, 255) setElementVisibleTo(marker, player, true) setElementVisibleTo(marker, root, false) addEventHandler("onMarkerHit", marker, markhit) end addCommandHandler("marker",redpoint) function markhit (element) if element and getElementType ( element ) == "player" then local blip = getElementAttachedTo (source) if (blip) then destroyElement(blip) end destroyElement(source) end end
  18. Walid

    help

    try sth like this (untested i'm using the phone) local killer = {} function wasted(ammo, attacker, weapon, bodypart ) if (attacker and isElement(attacker) and attacker ~= source) then if (getElementType(attacker) == "player") then outputChatBox("" .. getPlayerName(source) .. " has been killed by " .. getPlayerName(attacker) .. ".",root,100,155,100) killer[source] = attacker end end end addEventHandler ( "onPlayerWasted", root, wasted ) function call911(player) if isElement(killer[player]) then setPlayerWantedLevel (killer[player],1) killer[player] = nil end end addCommandHandler("911",call911)
  19. local aclGroup = {"Admin","SuperModerator","Moderator","Console","Administrator"} function adminMessage(thePlayer, theCommand, ...) local account = getPlayerAccount(thePlayer) if account and not isGuestAccount(account) then local accountName = getAccountName(account) local messageParameters = {...} local fullString = table.concat(messageParameters, " ") local passed = false for i=1 , #aclGroup do if(isObjectInACLGroup("user."..accountName, aclGetGroup(aclGroup[i]))) then outputAdminMessage(thePlayer, fullString) passed = true break end end if not passed then outputChatBox("ACCESS DENIED, You are not Admin", thePlayer, 255, 0, 0, true) end end end addCommandHandler("adm", adminMessage) function outputAdminMessage(thePlayer, theMessage) outputChatBox("#ff0000~>#ff8c00Announcement: "..theMessage, root, 255, 255, 255, true) end
  20. function resourceStart() local realtime = getRealTime() setTime(realtime.hour, realtime.minute) setMinuteDuration(60000) end addEventHandler("onResourceStart", getResourceRootElement(), resourceStart)
  21. Fixed some mistakes local safeZonesTable = { { x = 1578.2421875, y = 1801.248046875, z = 10.8203125, width = 58, depth = 61, height = 100 }, { x = 1996.958984375, y = -1450.9560546875, z = 13.5546875, width = 100, depth = 55, height = 100 }, { x = -2740.775390625, y = 577.9326171875, z = 14.5546875, width = 150, depth = 100, height = 100 } } local controls = { "fire", "next_weapon", "previous_weapon" } addEventHandler ( "onResourceStart", resourceRoot, function ( ) for _, zone in ipairs ( safeZonesTable ) do local safeZone = createColCuboid ( zone.x, zone.y, zone.z - 30, zone.width, zone.depth, zone.height ) createRadarArea ( zone.x, zone.y, zone.width, zone.depth, 0, 200, 0, 50 ) addEventHandler ( "onColShapeHit", safeZone, elementHitSafeZone ) addEventHandler ( "onColShapeLeave", safeZone, elementLeaveSafeZone ) end end ) function elementHitSafeZone ( theElement, mDim ) if theElement and isElement(theElement) and getElementType ( theElement ) == "player" then if (isPedInVehicle(theElement)) then local vehicle = getPedOccupiedVehicle(theElement) exports.GTWvehicleshop:saveAndRemoveVehicle (vehicle, true) end for _, control in ipairs ( controls ) do toggleControl (theElement,control, false ) end exports.GTWtopbar:dm ( "You entered the safezone, all weapons are forbidden.", theElement, 200, 50, 50 ) end end function elementLeaveSafeZone ( theElement, mDim ) if theElement and isElement(theElement) and getElementType ( theElement ) == "player" then for _, control in ipairs ( controls ) do toggleControl (theElement,control, true ) end exports.GTWtopbar:dm ( "You left the safezone.", theElement, 200, 50, 50 ) end end
×
×
  • Create New...