Jump to content

LLCoolJ

Members
  • Posts

    27
  • Joined

  • Last visited

2 Followers

About LLCoolJ

  • Birthday 19/09/2001

Details

  • Gang
    [Victory]
  • Location
    Russia
  • Interests
    Programming

Recent Profile Visitors

1,548 profile views

LLCoolJ's Achievements

Advanced Member

Advanced Member (8/54)

7

Reputation

  1. LLCoolJ

    Help me

    local x,y = guiGetScreenSize() addEventHandler("onClientResourceStart", resourceRoot,function() weaponWindow = guiCreateWindow((x/2)-(256/2),(y/2)-(398/2), 256, 382, "weapon",false) guiWindowSetSizable(weaponWindow, false) weaponGrid = guiCreateGridList(16, 30, 226, 337,false,weaponWindow) guiGridListAddColumn(weaponGrid, "Inventory", 0.9) guiSetVisible (weaponWindow, false ) toggleControl ( "next_weapon", false) toggleControl ( "previous_weapon", false) guiGridListSetSortingEnabled ( weaponGrid, false ) addEventHandler("onClientGUIDoubleClick",weaponWindow,selectWeapon) end) addEventHandler("onClientResourceStop", resourceRoot,function() toggleControl ( "next_weapon", true) toggleControl ( "previous_weapon", true) end) bindKey("k","down", function() guiSetVisible(weaponWindow,not guiGetVisible(weaponWindow)) showCursor(guiGetVisible(weaponWindow)) refreshWeapons() end) function refreshWeapons() guiGridListClear(weaponGrid) for i=1,9 do local weapon = getPedWeapon(localPlayer,i) if weapon and weapon ~= 0 then guiGridListAddRow(weaponGrid) guiGridListSetItemText(weaponGrid,guiGridListAddRow(weaponGrid),1,getWeaponNameFromID(weapon),false,false) end end end function selectWeapon() local row,col = guiGridListGetSelectedItem(weaponGrid) local text = guiGridListGetItemText(weaponGrid,row,col) if text ~= "" then setPedWeaponSlot(localPlayer,getSlotFromWeapon(getWeaponIDFromName(text))) end end
  2. Your code works.Are you sure that you have attached elements to vehicle? addCommandHandler("ivi",function() det = getAttachedElements(getPedOccupiedVehicle(localPlayer)) if #det > 0 then for k,v in ipairs(det) do outputDebugString(tostring(v)) end else outputChatBox("no elements were attached") end end) or addCommandHandler("ivi",function() det = getAttachedElements(getPedOccupiedVehicle(localPlayer)) iprint(det) end)
  3. bindKey("F2", "down", function() showCursor(guiSetVisible(Ventana,not guiGetVisible(Ventana)) and guiGetVisible(Ventana)) end)
  4. LLCoolJ

    Trunk open

    local ms = 1000 addCommandHandler("trunk", function(player) local vehicle = getPedOccupiedVehicle(player) if isElement(vehicle) and getElementModel(vehicle) == 541 then if getVehicleDoorOpenRatio(vehicle,1) > 0 then setVehicleDoorOpenRatio(vehicle,1,0,ms) else setVehicleDoorOpenRatio(vehicle,1,1,ms) end end end) Use getElementModel
  5. LLCoolJ

    Trunk open

    local ms = 1000 addCommandHandler("trunk", function(player) local vehicle = getPedOccupiedVehicle(player) if isElement(vehicle) then if getVehicleDoorOpenRatio(vehicle,1) > 0 then setVehicleDoorOpenRatio(vehicle,1,0,ms) else setVehicleDoorOpenRatio(vehicle,1,1,ms) end end end) Server side
  6. function getAllPlayerInDimension(dimension) local rValue = {} for i,v in ipairs(getElementsByType("player")) do if ( getElementDimension ( v ) == dimension ) then table.insert(rValue,getPlayerName(v)) end end return rValue end function SetDimensionLobby() outputChatBox("all players in Dimension 0:"..table.concat(getAllPlayerInDimension(0),",")) end addCommandHandler ("s",SetDimensionLobby)
  7. local AFK = {} function getAFKTableSize(t) local count = 0 if t and type(t) == "table" then for k in next,t do if isElement(k) then count = count + 1 end end end return count end function playerDataChanges(data) if data == "afk_state" then local value = getElementData(source,data) if value == "afk" then if getAFKTableSize(AFK) == 0 then addEventHandler("onClientRender",root,Render) end AFK[source] = true elseif value == "back" then AFK[source] = nil if getAFKTableSize(AFK) == 0 then removeEventHandler("onClientRender",root,Render) end end end end addEventHandler("onClientElementDataChange",root,playerDataChanges) function Render() for player in next,AFK do if isElement(player) then local myPos = {getElementPosition(localPlayer)} local head = {getPedBonePosition(player,8)} if getDistanceBetweenPoints3D(myPos[1],myPos[2],myPos[3],head[1],head[2],head[3]) <= 30 then local x,y = getScreenFromWorldPosition(head[1],head[2],head[3]+0.3) if x and y then dxDrawText("AFK",x,y,x,y,tocolor(255,255,255,255),2,"sans","center","center") end end end end end Client side
  8. addEventHandler("onClientRender",getRootElement(),function() local px,py,pz,tx,ty,tz,dist px,py,pz = getCameraMatrix() for id,player in ipairs(getElementsByType("player")) do tx,ty,tz = getElementPosition(player) dist = math.sqrt((px-tx)^2 + (py-ty)^2 + (pz-tz)^2) if dist <= 30.0 then if isLineOfSightClear(px,py,pz,tx,ty,tz,true,false,false,true,false,false,true) then local sx,sy,sz = getPedBonePosition(player,5) local x,y = getScreenFromWorldPosition(sx,sy,sz+0.3) if x then dxDrawText(getPlayerName(player),x,y,x,y,tocolor(150,50,0),0.85+(15-dist)*0.02,"default-bold","center","center") end end end end end)
  9. 'onClientPlayerJoin' event will trigger for all players except the local player.You need to use 'onClientResourceStart'. Try this local x,y = guiGetScreenSize() local image addEventHandler("onClientResourceStart",resourceRoot, function() image = guiCreateStaticImage(x/2-400/2,y/2-400/2,400,400,"hello.png",false) end) Also add this line to your resource's meta.xml.It means that resource will be started earlier than other resources. <download_priority_group>1</download_priority_group>
  10. function JoinVehicleCar (player, seat) local acc = getAccountName(getPlayerAccount(player)) if seat == 0 then if (getVehicleType(source) == "Automobile" or getVehicleType(source) == "Bike") then if not (isObjectInACLGroup("user."..acc, aclGetGroup("HABCARMOTO"))) then cancelEvent() return outputChatBox("#000000[ #FFFF00CNH#000000 ] #FFFFFFVocê não possui #ff0000Habilitação #ffffff para conduzir este veiculo!",player,255,255,255, true) end end if (getVehicleType(source) == "Helicopter" or getVehicleType(source) == "Plane") then if not (isObjectInACLGroup("user."..acc, aclGetGroup("HABAERO"))) then cancelEvent() return outputChatBox("#000000[ #FFFF00CNH#000000 ] #FFFFFFVocê não possui #ff0000Habilitação #ffffff para conduzir este veiculo!",player,255,255,255, true) end end if (getVehicleType(source) == "Boat") then if not (isObjectInACLGroup("user."..acc, aclGetGroup("HABBOAT"))) then cancelEvent() return outputChatBox("#000000[ #FFFF00CNH#000000 ] #FFFFFFVocê não possui #ff0000Habilitação #ffffff para conduzir este veiculo!",player,255,255,255, true) end end end end addEventHandler("onVehicleStartEnter",root,JoinVehicleCar)
  11. setPedTargetingMarkerEnabled(false)
  12. toggler = { } dtype = { } syncTimer = { } currHeadLightColor = {{ }} function isVehicleBlinking( vehicle) if currHeadLightColor[vehicle] then return true else return false end end function toggleLights( veh ) if isElement( veh ) then setVehicleOverrideLights( veh, 2 ) if toggler[veh] == 1 then setVehicleLightState( veh, 0, 1 ) setVehicleLightState( veh, 1, 1 ) setVehicleLightState( veh, 2, 1 ) setVehicleLightState( veh, 3, 1 ) if veh and isElement(veh) and (getElementType(veh) == "vehicle") and getVehicleTowedByVehicle( veh ) then local veh2 = getVehicleTowedByVehicle( veh ) setVehicleLightState( veh2, 0, 1 ) setVehicleLightState( veh2, 1, 1 ) setVehicleLightState( veh2, 2, 1 ) setVehicleLightState( veh2, 3, 1 ) end toggler[veh] = 0 else if dtype[veh] == "left" then setVehicleLightState( veh, 0, 0 ) setVehicleLightState( veh, 1, 1 ) setVehicleLightState( veh, 2, 1 ) setVehicleLightState( veh, 3, 0 ) if veh and isElement(veh) and (getElementType(veh) == "vehicle") and getVehicleTowedByVehicle( veh ) then local veh2 = getVehicleTowedByVehicle( veh ) setVehicleLightState( veh2, 0, 0 ) setVehicleLightState( veh2, 1, 1 ) setVehicleLightState( veh2, 2, 1 ) setVehicleLightState( veh2, 3, 0 ) end elseif dtype[veh] == "right" then setVehicleLightState( veh, 0, 1 ) setVehicleLightState( veh, 1, 0 ) setVehicleLightState( veh, 2, 0 ) setVehicleLightState( veh, 3, 1 ) if (getElementType(veh) == "vehicle") and getVehicleTowedByVehicle( veh ) then local veh2 = getVehicleTowedByVehicle( veh ) setVehicleLightState( veh2, 0, 1 ) setVehicleLightState( veh2, 1, 0 ) setVehicleLightState( veh2, 2, 0 ) setVehicleLightState( veh2, 3, 1 ) end elseif (getElementType(veh) == "vehicle") and dtype[veh] == "all" then setVehicleLightState( veh, 0, 0 ) setVehicleLightState( veh, 1, 0 ) setVehicleLightState( veh, 2, 0 ) setVehicleLightState( veh, 3, 0 ) if veh and isElement(veh) and (getElementType(veh) == "vehicle") and getVehicleTowedByVehicle( veh ) then local veh2 = getVehicleTowedByVehicle( veh ) setVehicleLightState( veh2, 0, 0 ) setVehicleLightState( veh2, 1, 0 ) setVehicleLightState( veh2, 2, 0 ) setVehicleLightState( veh2, 3, 0 ) end end toggler[veh] = 1 end end end function lightHandler( player, cmd ) if player and isElement( player ) and getPedOccupiedVehicle( player ) then local veh = getPedOccupiedVehicle( player ) if ( not isTimer( syncTimer[veh] ) or cmd ~= dtype[veh] ) and getVehicleOccupants(veh)[0] == player then setVehicleLightState( veh, 0, 1 ) setVehicleLightState( veh, 1, 1 ) setVehicleLightState( veh, 2, 1 ) setVehicleLightState( veh, 3, 1 ) if veh and isElement(veh) and (getElementType(veh) == "vehicle") and getVehicleTowedByVehicle( veh ) then local veh2 = getVehicleTowedByVehicle( veh ) setVehicleLightState( veh2, 0, 1 ) setVehicleLightState( veh2, 1, 1 ) setVehicleLightState( veh2, 2, 1 ) setVehicleLightState( veh2, 3, 1 ) end if not currHeadLightColor[veh] then currHeadLightColor[veh] = { } currHeadLightColor[veh][1],currHeadLightColor[veh][2],currHeadLightColor[veh][3] = getVehicleHeadLightColor( veh ) end setVehicleHeadLightColor( veh, 255, 200, 0 ) if isTimer( syncTimer[veh] ) then killTimer( syncTimer[veh] ) setVehicleHeadLightColor(veh, currHeadLightColor[veh][1],currHeadLightColor[veh][2],currHeadLightColor[veh][3]) end syncTimer[veh] = setTimer( toggleLights, 380, 0, veh ) toggler[veh] = 1 dtype[veh] = cmd toggleLights( veh ) else if isTimer( syncTimer[veh] ) then killTimer( syncTimer[veh] ) local vehID = getElementData( veh, "vehicleID") if vehID then local vehID = tonumber( vehID) local colorTable = exports.GTIvehicles:getVehicleData( vehID, "light_color") or "255,255,255" local cData = split( colorTable, ",") setVehicleHeadLightColor( veh, cData[1], cData[2], cData[3]) currHeadLightColor[veh] = nil else setVehicleHeadLightColor( veh, 255, 255, 255) end end setVehicleLightState( veh, 0, 0 ) setVehicleLightState( veh, 1, 0 ) setVehicleLightState( veh, 2, 0 ) setVehicleLightState( veh, 3, 0 ) setVehicleOverrideLights( veh, 2 ) if veh and isElement(veh) and (getElementType(veh) == "vehicle") and getVehicleTowedByVehicle( veh ) then local veh2 = getVehicleTowedByVehicle( veh ) setVehicleLightState( veh2, 0, 0 ) setVehicleLightState( veh2, 1, 0 ) setVehicleLightState( veh2, 2, 0 ) setVehicleLightState( veh2, 3, 0 ) setVehicleOverrideLights( veh2, 2 ) end end end end addCommandHandler( "left", lightHandler ) addCommandHandler( "right", lightHandler ) addCommandHandler( "all", lightHandler ) addEvent("command:execute",true) addEventHandler("command:execute",resourceRoot, function(position) lightHandler(client,position) end) --//Client addEventHandler("onClientKey",getRootElement(), function(button,press) if press then if (button == "lshift" and getKeyState("a")) or (button == "a" and getKeyState("lshift")) then triggerServerEvent("command:execute",resourceRoot,"left") elseif (button == "lshift" and getKeyState("d")) or (button == "d" and getKeyState("lshift")) then triggerServerEvent("command:execute",resourceRoot,"right") elseif (button == "lshift" and getKeyState("s")) or (button == "s" and getKeyState("lshift")) then triggerServerEvent("command:execute",resourceRoot,"all") end end end)
  13. FadeCamera: local camPositions = { {-2816.0283203125, 2125.6923828125, 156.8657989502, -2720.1396484375, 1835.1181640625, 133.21673583984}, {-1145.0048828125, 879.6533203125, 9.1189212799072, -1357.7978515625, 719.6279296875, 14.321132659912}, {1135.3759765625, -1977.408203125, 78.517211914063, 1413.7529296875, -1617.5576171875, 63.588264465332}, {2160.0869140625, -102.408203125, 5.6070313453674, 1894.4580078125, -146.1396484375, 21.12876701355} } addEventHandler("onPlayerJoin",getRootElement(), function() fadeCamera(source,true,5) setCameraMatrix(source,unpack(camPositions[math.random(#camPositions)])) end) Spawn: local randomSpawnTable = { { 270.92654418945, -1986.3665771484, 797.52966308594 }, { 270.92654418945, -1986.3665771484, 797.52966308594 }, { 270.92654418945, -1986.3665771484, 797.52966308594 } } addEventHandler("onPlayerLogin",getRootElement(), function() spawnPlayer(source,unpack(randomSpawnTable[math.random(#randomSpawnTable)])) setCameraTarget(source,source) setElementModel(source, 312) giveWeapon(source,46) giveWeapon(source,9) giveWeapon(source,25,5000,true) giveWeapon(source,28,5000,true) giveWeapon(source,31,5000,true) giveWeapon(source,22,5000,true) end)
  14. --//Server addCommandHandler("sms", function(player,cmd,...) local messages = {} for i = 1,#arg do messages[i] = arg[i] end triggerClientEvent("onSMSTrigger", player, messages) end) --//Client local screenW, screenH = guiGetScreenSize() local sms = {} addEvent("onSMSTrigger", true) addEventHandler("onSMSTrigger", getRootElement(), function (newSMS) sms = newSMS end) addEventHandler("onClientRender", getRootElement(), function() local str = "" for i = 1,#sms do str = str..sms[i].."\n\n" end dxDrawText(str, (screenW * 0.2462) + 1, (screenH * 0.6833) + 1, (screenW * 0.8838) + 1, (screenH * 0.9933) + 1, tocolor(0, 0, 0, 255), 2.50, "default-bold", "left", "top", true, true, false, true, false) end) /sms <text>, or /sms <text1> <text2> <text3> Should work fine
×
×
  • Create New...