-
Posts
1,491 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Walid
-
Whole table gets deleted when first element is removed?
Walid replied to Einheit-101's topic in Scripting
i create this Table.removeValue today try it. it should work. function removeFromTable() if getElementType( source ) == "vehicle" and (getElementModel(source) == 432 or getElementModel(source) == 601) then if table.contains(tanks, source) then table.removeValue(tanks, source ) end end end addEventHandler("onClientElementDestroy", root, removeFromTable) addEventHandler( "onClientElementStreamOut", root, removeFromTable) -
:3 Wrong ,many things wrong. Example using button -- Client function open() triggerServerEvent("EventNameHere",localPlayer) end bindKey("F2", "down",open) -- Server function YourFunction () local table = getPlayers() triggerClientEvent(source, "RUN3",source,table) end addEvent("EventNameHere",true) addEventHandler("EventNameHere",root,YourFunction)
-
What ??? open your eyes I didn't finish the code. for index, players in ipairs (getElementsByType("player")) do end
-
Try this it should : -- Server side function getPlayers() local playersInRun = {} for index, players in ipairs (getElementsByType("player")) do if getElementData(players, "RUN") then table.insert(playersInRun, players) end end return playersInRun end function hijackerDC () if getElementData(source, "RUN") then table.removevalue( readyPlayerList, source ) end end addEventHandler("onPlayerQuit",root, hijackerDC) -- table.removevalue function, in case you don't already have it function table.removevalue(t, val) for i,v in ipairs(t) do if v == val then table.remove(t, i) return i end end return false end -- use triggerClientEvent then send the whole table to the client side -- Client side function addRunPlayer(table) local playerGrid = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) local column = guiGridListAddColumn( playerGrid, "Player", 0.85 ) if column then for id, player in ipairs(table) do local row = guiGridListAddRow ( playerGrid ) guiGridListSetItemText ( playerGrid, row, column, getPlayerName ( player ), false, false ) end end end -- Add you event handler here
-
There is more than one way to do it. Example 1 : -- Using table local Ranks = {"Trial Staff","Trained Staff","Etc ..."} -- Put all your ranks here and make sure to add them all to your ACL.xml file. -- function to check if the player staff or not function isPlayerStaff (player) if isElement(player) and getElementType (player) == "player" then for a, g in ipairs (Ranks) do if isPlayerInACL (player,g) then return true end end end return false end -- get staff rank function getStaffRank (player) if isPlayerStaff (player) then for a, g in ipairs (Ranks) do if isPlayerInACL (player,g) then return tostring (g) end end end return false end function isPlayerInACL ( player, acl ) local account = getPlayerAccount ( player ) if ( isGuestAccount ( account ) ) then return false end if ( aclGetGroup ( acl ) ) then return isObjectInACLGroup ( "user."..getAccountName ( account ), aclGetGroup ( acl ) ) end return false; end function getOnlineStaff ( ) local online = { } for i, v in ipairs ( getElementsByType ( "player" ) ) do if ( isPlayerStaff ( v ) ) then table.insert ( online, v ) end end return online end Example 2 : -- Add all admins accounts name inside a tabe like this Admins = { {"Bla ", "Head Staff"}, {"Bla Bla","Trial Staff"}, } function staffRanks(_,acc) for index, data in pairs(Admins) do if (getAccountName(acc) == data[1]) then setElementData(source, "staffRank", data[2]) end end end addEventHandler("onPlayerLogin", root, staffRank) function isPlayerStaff(player) if isElement(player) then if (getElementData(player, "staffRank")) then return true else return false end end return false end function getStaffRank (player) if isPlayerStaff (player) then return getElementData(player, "staffRank") end end -- Etc ...
-
[ International - Host ] Host te9bel daf3 tounsi
Walid replied to Hadjaliiheb's topic in Maghrebi Arabic / Darija / الدارجة
lol me Dus Attack tefhem kol chay ; its' Dos attack. w ken mata3rech chnia lfare9 bin Dos w DDos nans7ek ta9ra : Difference Between DoS and DDoS Attack -
use the engine function all what you need is : dxCreateTexture() dxCreateShader() dxSetShaderValue() engineApplyShaderToWorldTexture()
-
try this it should work bank = createObject(2942, 2489.6000976563, -1667.3000488281, 13) marker = createMarker(2489.6000976563, -1667.3000488281, 13, "corona", 2.0, 0, 0, 0, 0, getRootElement()) attachElements(marker, bank) function onHitBankautomat(player, dim) if dim and isElement(player) and getElementType(player) == "player" then outputChatBox("Function triggered!", player, 0, 200, 0) end end addEventHandler("onMarkerHit", marker, onHitBankautomat)
-
Try to use Hotspot Shield.
-
SetPlayerHudComponentVisible
-
Try this addEventHandler("onElementDataChange", getRootElement(), function (dataName) if (getElementType(source) == "player") and (dataName == "experience") then local theAccount = getPlayerAccount(source) if (theAccount) and not (isGuestAccount(theAccount)) then local experience = getElementData(source, "experience") or 0 local experience_r = getElementData(source, "experience_r") or 0 if (experience >= tonumber(experience_r)) then -- Your code here end end end end )
-
could you show me what you mean? i was looking at Wiki, but i didnt understand that lol change the timer in your "moveTable".
-
Simply use the same timer.
-
there is no way , the only one is using multiple computers, virtual ...
-
Try this one untested levels = { [1] = 100, [2] = 200, [3] = 300, } maxlvl = 4 function givePlayerXP ( _,player) if isElement(player) and getElementType(player) == "player" then local currXP = getElementData (player,"xp") or 0 local currLVL = getElementData(player,"level") or 1 setElementData(player,"xp",currXP + 10) if currLVL < 4 then setElementData(player,"xp",currXP + levels[currLVL]) setElementData(player,"level",currLVL + 1) outputChatBox ("Rank up"..(currLVL+1), player, 255, 25, 0, true) end end end addEventHandler("onPlayerWasted",root,givePlayerXP)
-
All what you need is -- Functions dxDrawRectangle() -- Events onClientClick onClientRender
-
Try to use math.round function math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end
-
-- Function guiSetVisible () showCursor () -- Events onClientGUIClick
-
Check the wiki page before u start asking all what you need is here : SetTimer
-
what do you mean? the minimum is 50 milliseconds.
-
Try to do it by yourself then post your code here and we will help u.
-
Try to do it by yourself then post your code here and we will help you.
-
[quote name=..&G:..]Doesn't work... it still says "table expected got nil" check your vehicleTable. and post full code here.