Jump to content

Walid

Members
  • Posts

    1,491
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Walid

  1. Walid

    [HELP] Skin

    function onDisconnect () local account = getPlayerAccount(source) if account and not isGuestAccount(account) then local fac = getElementData(source,"Faction") or 0 if (tonumber(fac) == 1) then local skin = getElementModel(source) if groveSkin[skin] then setAccountData(account,"Original",skin) end end end end addEventHandler ("onPlayerQuit", root, onDisconnect) on player login use > getAccountData() then > setElementData().
  2. Try this function rankMySelf (thePlayer) local account = getPlayerAccount(thePlayer) if account and not isGuestAccount(account) then local accName = getAccountName (account) local oFaction = getElementData(thePlayer, "Faction") or 0 if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then if tonumber(oFaction) == 0 then setElementData(thePlayer, "Faction", 1) setElementData(thePlayer, "Rank", 6) outputChatBox ("working", thePlayer) end end end end addCommandHandler( "rankme", rankMySelf)
  3. Why your are using many tables , put all of them inside one table. your code will be definitely tidier and easier to read. Example: local attach = { -- skin Id, Weapon Id, Object Id, bone, x,y,z,rx,ry,rz {21,29,1855,12,0,0,0,-3,-90,0} }
  4. All what you need is: -- Table local ComponentName = { [1] = "wheel_rf_dummy", --Right Front Wheel [2] = "wheel_lf_dummy", --Left Front Wheel [3] = "wheel_rb_dummy", --Right Back Wheel [4] = "wheel_lb_dummy", --Left Back Wheel } -- Functions getVehicleComponentPosition() getVehicleComponentRotation() setVehicleComponentVisible() createObject() setElementPosition() setElementRotation() setObjectScale() attachElements() -- Events "onClientVehicleEnter" "onClientVehicleExit" "onClientPreRender"
  5. are you sure you didn't change the table name . working fine for me local attach = {} function custom_mp40(prev,cur) local id = getElementModel(source) if id == 21 then if cur == 29 then if isElement(attach[source]) then destroyElement(attach[source]) attach[source] = nil end attach[source] = createObject(1855,0,0,0) exports.bone_attach:attachElementToBone(attach[source],source,12,0,0,0,-3,-90,0) outputChatBox("created",source, 255, 255, 0) else if isElement(attach[source]) then destroyElement(attach[source]) attach[source] = nil outputChatBox("destroyed",source, 0,255,0) end end end end addEventHandler ("onPlayerWeaponSwitch", getRootElement(),custom_mp40) function onWasted() if isElement(attach[source]) then destroyElement(attach[source]) attach[source] = nil outputChatBox("destroyed",source) end end addEventHandler("onPlayerWasted",root,onWasted)
  6. function onWasted() if isElement(attach[source]) then destroyElement(attach[source]) attach[source] = nil end end addEventHandler("onPlayerWasted",root,onWasted)
  7. Walid

    destroy blip?

    Use the whole code server side.
  8. Walid

    destroy blip?

    Try this: local blips = {} function createMarkers ( ) loc = math.random ( #markers ) marker = createMarker ( markers[loc][1], markers[loc][2], markers[loc][3], "cylinder", 5.0, 0, 0, 255, 150 ) blips[marker] = createBlipAttachedTo(marker, 41) addEventHandler ( "onClientMarkerHit", marker, MarkerHit ) end function MarkerHit ( hitPlayer, matchingDimension ) if (hitPlayer == localPlayer) then if blips[source] then destroyElement(blips[source]) destroyElement(source) createMarkers() end end end
  9. replace car.xml with car.lua here: (SS) Try to use tables (much better) Example: local vehicle = {} function mycar(player) local account = getPlayerAccount(player) if account and not isGuestAccount(account) then local accountName = getAccountName(account) if isObjectInACLGroup("user." ..accountName, aclGetGroup("Owners")) then if vehicle[player] then destroyElement(vehicle[player]) end local position = Vector3(getElementPosition(player)) local rotation = Vector3(getElementRotation(player)) local color = Vector3(255,0,0) vehicle[player] = createVehicle(602,position.x,position.y,position.z+1) setElementRotation(vehicle[player],rotation.x,rotation.y,rotation.z) setVehicleHeadLightColor (vehicle[player],color.x,color.y,color.z) setVehicleColor(vehicle[player],color.x,color.y,color.z) end end end addCommandHandler("MyCarRed",mycar) addEventHandler( "onPlayerQuit", getRootElement( ), function() if vehicle[source] then destroyElement(vehicle[source]) end end )
  10. Why you create an other topic already answered you here
  11. use my useful function removeHex
  12. check your code as i can see source == vehicle. anyways try this: local g_ArmedVehicles = {[425] = true,[447] = true,[520] = true,[430] = false,[464] = false,[432] = true} function checkNoDMGreen() local vehicles = getElementsByType ( "vehicle" ) for _, vehicle in ipairs(vehicles) do if g_ArmedVehicles[getElementModel(vehicle)] then local player = getVehicleController (vehicle) if player then -- check elementData here then usetoggleControl toggleControl(player, 'vehicle_fire', false) toggleControl(player, 'vehicle_secondary_fire', false) end end end end setTimer(checkNoDMGreen,100,0)
  13. I think you don't undrestand what i'm talking about. anyways here is what you want -- Client side: addEventHandler("onClientResourceStart", resourceRoot, function() local screenW, screenH = guiGetScreenSize() local windowW, windowH = 739, 379 local x, y = (screenW - windowW) /2,(screenH - windowH) /2 window = guiCreateWindow(x, y, windowW, windowH, "", false) guiWindowSetSizable(window, false) guiWindowSetMovable(window, false) guiSetVisible(window, false) gridlist = guiCreateGridList(9, 24, 720, 345, false, window) guiGridListAddColumn(gridlist, "Имя Фамилия", 0.3) guiGridListAddColumn(gridlist, "Уровень", 0.3) guiGridListAddColumn(gridlist, "Пинг", 0.3) scrollbar = guiCreateScrollBar(681, 19, 15, 310, false, false, gridlist) guiScrollBarSetScrollPosition(scrollbar, 100.0) end ) function openpanel (tab) guiSetVisible(window, not guiGetVisible(window)) showCursor(guiGetVisible(window)) addPlayersToTab(tab) end addEvent("eventName", true) addEventHandler("eventName", root, openpanel) function addPlayersToTab (tabTable) guiGridListClear(gridlist) for i,v in pairs (tabTable) do local row = guiGridListAddRow(gridlist) guiGridListSetItemText(gridlist, row, 1, v[1], false, false) guiGridListSetItemText(gridlist, row, 2, v[3], false, false) guiGridListSetItemText(gridlist, row, 3, v[2], false, false) end end -- Server side -- show up tab panel function showUp (player, key, keyState ) playersTab = {} if ( keyState == "down" ) then for index, player in ipairs(getElementsByType("player")) do local account = getPlayerAccount(player) if account and not isGuestAccount(account) then local playerName = getPlayerName(player) local ping = getPlayerPing(player) local lvls = getAccountData(account, "lvl") or 0 table.insert(playersTab,{playerName,ping,lvls}) end end triggerClientEvent(player,"eventName", player, playersTab) end end -- bind key function function bindTab( thePlayer ) bindKey(thePlayer, "tab","down",showUp) end -- bind key on player join function startBind () bindTab(source) end addEventHandler("onPlayerJoin",getRootElement(), startBind) -- bind key on resource start function bindForAll () for index, player in pairs(getElementsByType("player")) do bindTab(player) end end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), bindForAll )
  14. try this. local attach = {} function attchweapon(prev,cur) local id = getElementModel(source) if id == 21 then if cur == 29 then if isElement(attach[source]) then destroyElement(attach[source]) attach[source] = nil end attach[source] = createObject(1855,0,0,0) exports.bone_attach:attachElementToBone(attach[source],source,12,0,0,0,-3,-90,0) outputChatBox("created",source, 255, 255, 0) else if isElement(attach[source]) then destroyElement(attach[source]) attach[source] = nil outputChatBox("destroyed",source, 0,255,0) end end end end addEventHandler ("onPlayerWeaponSwitch", getRootElement(),attchweapon)
  15. attach it server side.
  16. -- Server side function getLevel (thePlayer) local account = getPlayerAccount(thePlayer) if account and not isGuestAccount(account) then local playerName = getPlayerName(thePlayer) local lvls = getAccountData(account, "lvl") or 0 local ping = getPlayerPing (thePlayer) -- etc ... -- then triggerClientevent triggerClientEvent(thePlayer,"eventName",thePlayer,playerName,lvls,ping) end end addCommandHandler("tab",getLevel) -- Client side function pg (playerName,lvls,ping) local account = getPlayerAccount(thePlayer) local lvls = getAccountData(account, "lvl") or 0 -- etc end addEvent ("eventName", true) addEventHandler("eventName", root, pg )
  17. triggerClientEvent()
  18. working fine for me check your elementData.
  19. didn't work because: source: not defined in your code. player: same thing with player. Try to use "onPlayerVehicleEnter" or just get a table of all the vehicles that exist and loop through it. Example: local g_ArmedVehicles = {[425] = true,[447] = true,[520] = true,[430] = false,[464] = false,[432] = true} function checkNoDMGreen() local vehicles = getElementsByType ( "vehicle" ) for _, vehicle in ipairs(vehicles) do if g_ArmedVehicles[getElementModel(vehicle)] then local invicsible = getElementData(vehicle,"invincible") local green = getElementData(vehicle,"green") if invicible or green then local player = getVehicleController (vehicle) if player then toggleControl(player, 'vehicle_fire', false) toggleControl(player, 'vehicle_secondary_fire', false) end end end end end setTimer(checkNoDMGreen,100,0)
×
×
  • Create New...