-
Posts
732 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Bean666
-
that should work i guess.
-
why not use onClientVehicleEnter?
-
nvm it works fine when i used: function quitPlayer () local account = getPlayerAccount (source) local data = getElementData(source, "toughperk") if data == true then setAccountData (account, "toughperk", true ) end end addEventHandler ( "onPlayerQuit", getRootElement(), quitPlayer ) addEventHandler ( 'onPlayerLogin', getRootElement ( ), function ( _, theCurrentAccount) local ifaccountperk = getAccountData(theCurrentAccount, "toughperk") if ifaccountperk == true then setElementData(source,"toughperk", true) setAccountData (account, "toughperk", false ) else setElementData(source,"toughperk", false) end end )
-
ok i got it working but , how can i save a player's Element Data when he quits the game? and when he joins game it sets the saved Element Data?
-
ok thanks i just had to remove 1 end and it's already working , thanks. anyways will this work if i get the player's data? if (getElementType(player) == "player") and getElementData(player, "toughperk") == true then
-
like this? function toughperk( ) setElementData(localPlayer,"tough", true) end addEventHandler ( "onClientGUIClick", button, toughperk )
-
uhm just a question will this set the player's ElementData to "tough" when he clicks the button "button"? function toughperk( ) if (source == localPlayer) then setElementData(localPlayer,"tough", true) end end addEventHandler ( "onClientGUIClick", button, toughperk )
-
hi, im asking a question what if i make a function with setElementData in a resource. then if i make another resource will getElementData work with the data i set in the other resource? will it get the data from the other resource?
-
try changing getrootelement to player
-
not tested try(but i will think this will play to all players through the map), anyways just try. function start_sound() outputChatBox("triggerClientEvent") for _, player in ipairs(getElementsByType("player")) do triggerClientEvent(getRootElement(), "start_sound", getRootElement()) end end
-
function ammuEnter() if (source == localPlayer) then guiSetVisible(ammu.window[1], true) showCursor(true, false) toggleAllControls(false, false, true) toggleControl("fire", false) toggleControl("aim_weapon", false) end addEventHandler("onClientMarkerHit", resourceRoot, ammuEnter)
-
man this script was working before.. but idk it suddenly got bugged, script is still working in RADAR, but in F11 it's not , i can still see players from far distance in F11, i have all other blip scripts off. local playerBlips = {} local distance = 30 addEventHandler("onClientResourceStart", resourceRoot, function() for k, thePlayer in ipairs(getElementsByType("player")) do if not (playerBlips[thePlayer]) and not (thePlayer == localPlayer) then playerBlips[thePlayer] = createBlipAttachedTo(thePlayer, 0, 2) end end end) addEventHandler("onClientPlayerJoin", root, function() if not (playerBlips[source]) and not (source == localPlayer) then playerBlips[source] = createBlipAttachedTo(source, 0, 2) end end) addEventHandler("onClientRender", root, function() for thePlayer, theBlip in pairs(playerBlips) do if (isElement(thePlayer)) and (isElement(theBlip)) and not (thePlayer == localPlayer) then local R, G, B = getPlayerNametagColor(thePlayer) local px, py, pz = getElementPosition(thePlayer) local bx, by, bz = getElementPosition(theBlip) setBlipColor(theBlip, R, G, B, 255) setBlipVisibleDistance(theBlip, distance) if (getDistanceBetweenPoints3D(px, py, pz, bx, by, bz) >= distance) then setBlipColor(theBlip, R, G, B, 0) end end end end) addEventHandler("onClientPlayerQuit", root, function() if (isElement(playerBlips[source])) then destroyElement(playerBlips[source]) playerBlips[source] = nil end end)
-
why does the weapon drop only on the north side?if im facing south , the weapon drops behind of me how to fix that? i want it to drop in front of your player. function drop(player,cmd,amount) local x,y,z = getElementPosition(player) local weapon = getPedWeapon(player) local ammo = getPedTotalAmmo(player) local amount = tonumber(amount) local x,y,z = getElementPosition(player) local rot = getPedRotation(player) if ammo >= amount then takeWeapon(player,weapon,amount) setElementID(createPickup(x,y+5,z,2,weapon,5000,amount),"WeaponPickUp") outputChatBox("*You Dropped the Weapon successfuly",player,0,255,0,true) else outputChatBox("*You Don't Have that "..amount..".",player,255,0,0,true) end end addCommandHandler("drop",drop)
-
because you're using onClientPlayerWasted only. you can use triggerClientEvent way easier. if you want u can still use client , make sure to use "attacker" sorry for mistakes if i have ( not tested ) example: client: addEvent("showGUI", true) function guishow(player) guiSetVisible(score, true) end addEventHandler("showGUI",getRootElement(),guishow) server: function kill (attacker, weapon, bodypart, loss) if (attacker) then triggerClientEvent ( attacker, "showGUI", attacker ) end end addEventHandler ( "onPlayerWasted", getRootElement(), kill)
-
can you show me what you would do as it sounds easier??.
-
like this?: local msg = table.concat({...}, " ") if msg:find("/") == 1 and msg:len() > 1 then -- Command local cmd, params = msg:match("/(%S+)%s*(.*)") return executeCommandHandler(cmd, player, params) else -- Message -- ... end
-
i changed , now i want it to work in a localchat system. see above this local chat system is made by you fyi.
-
im using a localchat system but commands does not seem to work.. how can i enable it in this custom chat system? i want to enable commands in this localchat system chat_range=30 addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"T","down","chatbox","Say") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"T","down","chatbox","Say") end end) function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onChat(player,_,...) local px,py,pz=getElementPosition(player) local msg = table.concat({...}, " ") local nick=getPlayerName(player) for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("[Local]"..nick..": #ffffff"..msg,v,150,150,150,true) end end end addCommandHandler("Say",onChat)
-
nah that's all the tables in the script.
-
it's not what i mean, i want the all the 1000$ up there, they're not the same line as the other rows. how to fix it? here is the gridlist/rows part: skins = { {"M4", 31}, {"AK47", 30}, {"Shotgun", 25}, {"Sniper", 34}, } cost = { "1000$", "1000$", "1000$", "1000$" } window = guiCreateWindow(0.31, 0.21, 0.38, 0.63, "Weapon Shop", true) guiWindowSetSizable(window, false) guiSetVisible(window, false) spawnG = guiCreateGridList(0.02, 0.04, 0.56, 0.94, true, window) guiGridListSetSelectionMode ( spawnG, 2 ) local column1 = guiGridListAddColumn(spawnG, "Weapons:", 0.5) local column2 = guiGridListAddColumn(spawnG, "Cost:", 0.5) for i,skins in ipairs(skins) do row = guiGridListAddRow(spawnG) guiGridListSetItemText(spawnG, row, 1, tostring(skins[1]), false, false) guiGridListSetItemData(spawnG, row, 1, tostring(skins[2])) end for key,cost in pairs(cost) do local row = guiGridListAddRow(spawnG) guiGridListSetItemText ( spawnG, row, 2, cost, false, false ) end guiGridListAddRow(spawnG) spawnbtn = guiCreateButton(0.63, 0.31, 0.30, 0.11, "Buy", true, window) cancel = guiCreateButton(0.63, 0.54, 0.30, 0.11, "Cancel", true, window) function buyweapon() if ( source == spawnbtn ) then local row, col = guiGridListGetSelectedItem( spawnG ) local name = guiGridListGetItemText( spawnG, row, col ) if name == "M4" then local id = 31 triggerServerEvent("spawn", getLocalPlayer(), id) elseif name == "AK47" then local id = 30 triggerServerEvent("spawn2", getLocalPlayer(), id) elseif name == "Shotgun" then local id = 25 triggerServerEvent("spawn3", getLocalPlayer(), id) elseif name == "Sniper" then local id = 34 triggerServerEvent("spawn4", getLocalPlayer(), id) end end end addEventHandler("onClientGUIClick",root,buyweapon)
-
probably they were corona markers attached to the hunter's rockets.
-
why is it like this? cost = { "1000$", "1000$", "1000$", "1000$" } spawnG = guiCreateGridList(0.02, 0.04, 0.56, 0.94, true, window) guiGridListSetSelectionMode ( spawnG, 2 ) local column1 = guiGridListAddColumn(spawnG, "Weapons:", 0.5) local column2 = guiGridListAddColumn(spawnG, "Cost:", 0.5) Cost part: for key,cost in pairs(cost) do local row = guiGridListAddRow ( spawnG ) guiGridListSetItemText ( spawnG, row, 2, cost, false, false ) end