-
Posts
667 -
Joined
-
Last visited
-
Days Won
4
Everything posted by Mr.Loki
-
something like this local playerTimer ={} local gambling = createMarker ( 0, 0, 3, "cylinder", 1, 255, 0, 0, 255 ) addEventHandler("onMarkerHit",gambling, function(player) if getElementType(player) == "player" then if getPlayerMoney(player) >= 5000 then local ptimer=playerTimer[player] if isTimer(ptimer) then outputChatBox ("#00ff00I'm sorry but you need to wait "..math.ceil(getTimerDetails( ptimer )/1000).." seconds before you can play again.",player, r, g, b, true) return else playerTimer[player]=setTimer(function()end,30000,1) end if math.random() < 1/2 then outputChatBox ("#0000ffWelcome to the Dragon Gambling House Dice! Would you like to play?",player, r, g, b, true) outputChatBox ("#ffffff*The dealer rolls the dice*",player, r, g, b, true) outputChatBox ("#00ff00Congratulations! You have won 5000$!",player, r, g, b, true) givePlayerMoney(player,5000) else outputChatBox ("#ff0000Welcome to the Dragon Gambling House Dice! Would you like to play?",player, r, g, b, true) outputChatBox ("#ffffff*The dealer rolls the dice*",player, r, g, b, true) outputChatBox ("#00ff00Aww, too bad! You have lost 6000$!",player, r, g, b, true) takePlayerMoney(player,6000) end else outputChatBox("#0000ffYou do not have enough money.",player) end end end )
-
works for me https://streamable.com/i80n
-
Dude real the full quote its directly from the wiki. Tou have to use every argument in the function for it to work because the faceTowards x,y,z are the last 3 args. dxDrawMaterialLine3D ( 0, 0, 8, 0, 0, 3, material, 6, tocolor(255,255,255), 0, 1, 8) Draws a rectangle facing north. This is how it looks using every arg in the function. The last 3 is where the material line will face towards.
-
make use of the last 3 arguments in the function
-
change line 20 to: guiGridListSetItemText(window, row, 2, i..". "..getVehicleNameFromModel(v), false, false) it uses the index (i) to set a number
-
function getSideOfPlayer( player ) return player.matrix.position + player.matrix.right * math.random(.5,3) end local position = getSideOfPlayer(player) Enable OOP the position returned is in a Vector3 format
-
because 'getObjectByHit' isn't defined in your code.
-
Well the getObjectByHit( ) function is missing from the script. Maybe you removed it by mistake or something?
-
getObjectByHit( player ) is a custom function and should be defined in the script. Do you get any errors when starting the resource?
-
local positions = { { 371, -2040, 8 }, { 2274, -1036, 52 }, { -2245, -1723, 482 }, { -155, -2889, 428 }, } function DisappearPlayer (NamePlayer, Admin) local attempts = 0 local azar = math.random ( 1,#positions ) if isElement(position[azar][4]) then repeat azar = math.random ( 1,#positions ) attempts = attempts + 1 if attempts >= #positions then outputChatBox("All positions are taken.") -- Just a debug, dont use unless you want spam break end until not isElement(position[azar][4]) end local veh = getPedOccupiedVehicle(NamePlayer) if (veh) then setElementPosition(veh, unpack ( positions [ azar ] ) ) positions [ azar ] = veh -- Store the userdata in the table incase u need it for later. else setElementPosition(NamePlayer, unpack ( positions [ azar ] ) ) positions [ azar ] = NamePlayer -- Store the userdata in the table incase u need it for later. end end addEvent("random",true) addEventHandler("random",root,DisappearPlayer) function resetPositions() for i=1,#positions do if isElement(positions[i][4]) then positions[i][4] = nil end end end addEvent("onGameStart",true) addEventHandler("onGameStart",root,resetPositions) Untested but i think it should work. Just remember to call the onGameStart event before spawning the players.
-
At line 31 and 32 you are deleting then respawning. How can you respawn something that does not exist? Instead of deleting the vehicle how about just: Eject player from the vehicle. Set the vehicle position to somewhere off the map like (9999,9999,0). Then set the timer to respawn it. function destroyTheVehicles (hitElement, dimension) if (getElementType(hitElement) ~= "vehicle" or not dimension) then return end local player = getVehicleController(hitElement) if (isElement(player)) then removePedFromVehicle ( player ) end setElementPosition(hitElement,696969,696969,0) setTimer(respawnVehicle,5000,0)(hitElement) end
-
function projectileCreation( creator ) local projectileType = getProjectileType( source ) -- We get the projectile type if projectileType == 16 then -- If is grenade then... playsound3D("sound.mp3",getElementPosition(creator),false) --Play your grenade sound end end addEventHandler( "onClientProjectileCreation", getRootElement( ), projectileCreation ) for some reason i can't select LUA syntax...
-
server ports Edit: ooh you have to use the HTTP ports lol It works now i get a 401 Unauthorized as @LoveFist mentioned Thanks for your help guys ._.
-
Nope still did not work. I tried so many ways but all i got was operation Timed out(28) no matter if the server is online of offline.
-
Well i don't really need details all i want to know is if a server is online or not.
-
That would require adding the server to game-state.... but its 1 way
-
I am able to but I want it to be able add and removing servers from the script with ease.
-
To sync it with other players you can loop it through all the players in the server. you can try this: Client addEventHandler( "onClientRender", root, function () plrs = getElementsByType'player' for i=1,#plrs do if getElementData(plrs[i], "OnDuty") and plrs[i] ~= localPlayer then dxDrawTextOnElement(plrs[i],"]-Pie clan-[",1,30,255,255,255,255,3,"default-bold") end end end ) function dxDrawTextOnElement(TheElement,text,height,distance,R,G,B,alpha,size,font) local distance = distance or 20 local height = height or 1 local x, y, z = getElementPosition(TheElement) local x2, y2, z2 = getCameraMatrix() 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 dxDrawText(text, sx+4, sy+4, sx, sy, tocolor(0, 0, 0, alpha or 255), (size or 1)-(distanceBetweenPoints / distance), font or "arial", "center", "center") dxDrawText(text, sx, sy, sx, sy, tocolor(R or 255, G or 255, B or 255, alpha or 255), (size or 1)-(distanceBetweenPoints / distance), font or "arial", "center", "center") end end end Server function aduty ( player ) if isObjectInACLGroup ( "user." ..getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin") ) then if not getElementData(player, "OnDuty") then outputChatBox(" Administrator "..getPlayerName(player).." Is Now On Duty!",getRootElement(),255,0,0) outputServerLog(" Administrator "..getPlayerName(player).." Is Now On Duty!") else outputChatBox(" Administrator "..getPlayerName(player).." Is Now Off Duty!",getRootElement(),255,0,0) outputServerLog(" Administrator "..getPlayerName(player).." Is Now Off Duty!") end setElementData(player, "OnDuty", not getElementData(player, "OnDuty")) end end addCommandHandler("duty",aduty)
-
Do you know any other way? would ml_sockets work?