-
Posts
1,491 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Walid
-
triggerServerEvent("EventName" , localPlayer) source is localPlayer client is localPlayer triggerServerEvent("EventName" , resourceRoot or root) source is resourceRoot or root client is localPlayer
-
many things wrong you need to fix all of them by yourself. -- Client side function onRegisterKlick ( ) -- ready local username = guiGetText(GUIEditor.edit[3]) local passwort = guiGetText(GUIEditor.edit[4]) if username ~= "" and passwort ~= "" then if exports.dxgui:dxCheckBoxGetSelected ( checkboxM ) == true then checksaveM = true triggerServerEvent("register",getLocalPlayer(),getLocalPlayer(),username,passwort,checkSaveM) elseif exports.dxgui:dxCheckBoxGetSelected ( checkboxF ) == true then triggerServerEvent("register",getLocalPlayer(),getLocalPlayer(),username,passwort) else checksaveM = false checksaveF = false end end end addEventHandler("onClientDXClick",GUIEditor.button[4],onRegisterKlick,false) function closeLoginPanelR ( ) exports.dxgui:dxSetVisible(GUIEditor.window[2],false) guiSetVisible(GUIEditor.edit[3],false) guiSetVisible(GUIEditor.edit[4],false) showChat(true) setPlayerHudComponentVisible( "radar", true ) end addEvent("closeLoginPanelR",true) addEventHandler("closeLoginPanelR",getRootElement(),closeLoginPanelR) -- Server side function register_func (player, username, passwort, check) local acc = addAccount(username,passwort) if acc then if checksaveM then mann_func (player) else frau_func (player) end logIn(player,acc,passwort) triggerClientEvent(player,"closeLoginPanelR",player) else triggerClientEvent(player,"errorMsg2",player) end end addEvent("register",true) addEventHandler("register",getRootElement(),register_func) function mann_func (player) local playeraccount = getPlayerAccount (player) setAccountData (playeraccount, "gen", mann) setPedSkin (player, 78) end function frau_func () local playeraccount = getPlayerAccount (player) setAccountData (playeraccount, "gen", frau) setPedSkin (player, 77) end
-
already gave you the answer and you still crying like a child.
-
Hhhh are you serieus , do you think that i'm using C*T resource very funny kid , all t-shirts can be found here gtainside and about the resource ask ccw, he know every thing about it, Or simply ask arran to post here i don't have time to waste with someone like you. Kids everywhere.
-
4: call: falied to call gang_system:getGangData[string"?"]
Walid replied to stefutz101's topic in Scripting
function="getGangData" type="server" /> server side function not client side. try the same code server side. function text123(player) local gang = exports["gang_system"]:getPlayerGang(player) if gang ~= "None" then local color = exports["gang_system"]:getGangData(gang,'color') if ( type ( color ) == "table" ) then outputChatBox("test",player,color[1],color[2],color[3]) end end end addCommandHandler("one",text123) BTW i don't know nothing about this group system -
try this : ( just added AND) executeSQLQuery("DELETE FROM HeretricsGunStorage WHERE location = ? AND weapon = ?", location,id )
-
use this: local acscodes = {"1234", "1231"} local passwordEntred = guiGetText(accesscode.edit) if passwordEntred ~= "" then for _,password in pairs (acscodes) do if passwordEntred == password then -- your code here end end end
-
function uninvite (thePlayer, command, target) local account = getPlayerAccount(thePlayer) if account and not isGuestAccount(account) then if target then local uninvPlayer = getPlayerFromName(target) if uninvPlayer then local accounttarget = getPlayerAccount(target) if accounttarget and not isGuestAccount(accounttarget) then local oFaction = getAccountData(account, "Faction") local oRank = getAccountData(account, "Rank") local iFaction = getAccountData(accounttarget, "Faction") if (oFaction) and (oRank) and (iFaction) then if tonumber(oRank) == 6 then if tonumber(iFaction) == tonumber(oFaction) then -- put your code here end end end end end end end end addCommandHandler("uninvite", uninvite) write this *.* in Filters edit box and try again
-
Follow my steps: Open notepad++. Press CTRL+F. Click find in files (search mod normal). Write setElementAlpha in find what (editbox). Choose the directory you want. Then click Find All.
-
@Shaman123 , source is not defined in your code more than that you can't use it with setTimer so you need get a table of all the players that exist and loop through it. Example: function minutes() for i, thePlayer in ipairs(getElementsByType("player")) do local account = getPlayerAccount(thePlayer) if account and not isGuestAccount(account) then local Minutes = getAccountData(account,"Minutes") if Minutes then setAccountData(account,"Minutes",tonumber(Minutes)+1) end end end end setTimer ( minutes, 60000, 0 )
-
Simply to optimize your code you could use the player serial to save the timer without using setAccountData() , getAccountData() , onPlayerQuit bla bla bla > waste of time. timerTable[getPlayerSerial(player)] = setTimer(function() end, 900000, 1 )
-
Should be like this: function ex(player) -- if the timer exist then if isTimer(timerTable[player]) then outputChatBox( "Please wait!", player, 255, 0, 0) return end timerTable[player] = setTimer(function() end, 900000, 1 ) end addCommandHandler ("ex",ex)
-
r,g,b : not defined in your code. you don't need to use getElementModel. local inValidSkins = {[94] = true} addEvent("AdminPanel.setSkin", true) function setSkin(plr, getText) if plr and isElement(plr) then if tonumber(getText) then if inValidSkins[tonumber(getText)] then outputChatBox("#00FF00Este team es solo para #FF0000[ADM]#00FF00 o#FF0000 [LIDER]", client, 255, 0, 0, true) return end setElementModel(plr, tonumber(getText)) outputChatBox("#FF0000" ..getPlayerName(client).."#00FF00 Ha combiar su skin a #0B00FF("..getText..") ", plr, 0, 255, 0, true) outputChatBox("#00FF00Combiar #FF0000"..getPlayerName(plr).."#00FF00 skin a #0B00FF("..getText..") ", client, 0, 255, 0, true) end end end addEventHandler("AdminPanel.setSkin", root, setSkin)
-
Use my code : local timerTable = {} -- timer table -- save the time on player quit function save () local playerAccount = getPlayerAccount ( source ) -- get the player account if (isTimer(timerTable[source])) then -- if the timer exist then local remaining = getTimerDetails(timerTable[source]) -- then get the timer details if playerAccount and not isGuestAccount(playerAccount) then -- check if it's not a guest account setAccountData(playeraccount, "timer", tonumber(remaining)) -- save the timer using setAccountData killTimer(timerTable[source]) -- kill the timer timerTable[source] = nil end end end addEventHandler ("onPlayerQuit", root, save ) -- load the timer on player login function loadTimer (_,account) local timer = getAccountData(account, "timer") -- get the timer using getAccountData if (timer) then -- if the timer exist then timerTable[source] = setTimer(function() end, tonumber(timer), 1) -- start it again using setTimer end end addEventHandler ("onPlayerLogin", root, loadTimer) ofc it won't work you need to put this somewhere in your code: -- Example: if not isTimer(timerTable[thePlayer]) then timerTable[thePlayer] = setTimer(function() end, 900000, 1 ) end
-
Here is all what you need. local timerTable = {} -- timer table -- save the time on player quit function save () local playerAccount = getPlayerAccount ( source ) -- get the player account if (isTimer(timerTable[source])) then -- if the timer exist then local remaining = getTimerDetails(timerTable[source]) -- then get the timer details if playerAccount and not isGuestAccount(playerAccount) then -- check if it's not a guest account setAccountData(playeraccount, "timer", tonumber(remaining)) -- save the timer using setAccountData killTimer(timerTable[source]) -- kill the timer timerTable[source] = nil end end end addEventHandler ("onPlayerQuit", root, save ) -- load the timer on player login function loadTimer (_,account) local timer = getAccountData(account, "timer") -- get the timer using getAccountData if (timer) then -- if the timer exist then timerTable[source] = setTimer(function() end, tonumber(time), 1) -- start it again using setTimer end end addEventHandler ("onPlayerLogin", root, loadTimer)
-
Posting all your problems on the forum will never make you better in Lua language try to fix all of them by yourself , anyways you are welcome.
-
local inValidTeams = {["TeamName"] = true} -- replace teamName with the team you want addEvent("AdminPanel.setTeam", true) function setTeam(plr, getText) if plr and isElement(plr) then if getText then local team = getTeamFromName(getText) if not team then team = getText end if inValidTeams[getTeamName(team)] then -- you can use getTeamName or simply replace it with getText outputChatBox("#00FF00Este arma es solo para #FF0000[ADM]", client, r, g, b, true) return end setPlayerTeam(plr, team) outputChatBox("#FF0000" ..getPlayerName(client).."#00FF00 Ha combiar su team a #0B00FF("..getTeamName(team)..") ", plr, 0, 255, 0, true) outputChatBox("#00FF00Combiar #FF0000"..getPlayerName(plr).."#00FF00 team a #0B00FF("..getTeamName(team)..") ", client, 0, 255, 0, true) end end end addEventHandler("AdminPanel.setTeam", root, setTeam)
-
Try this local inValidVehicles = {[429] = true} addEvent("AdminPanel.giveVehicle", true) function giveVehicle(plr, getText) if plr and isElement(plr) then if (isPedInVehicle(plr)) then outputChatBox("#00FF00Ya en un vehiculo", client, 225, 0, 0) else local id = getVehicleModelFromName(getText) if not id then id = getText end if inValidVehicles[tonumber(id)] then outputChatBox("#00FF00Este vehiculo es solo para #FF0000[ADM]", client, 255,0,0, true) return end local position = Vector3(getElementPosition(plr)) local rotation = Vector3(getElementRotation(plr)) local veh = createVehicle(id, position.x, position.y, position.z + 3) setElementData(veh,"spawner",plr) if (veh) then warpPedIntoVehicle(plr, veh) setElementRotation(veh, rotation.x,rotation.y,rotation.z) end outputChatBox("#FF0000" ..getPlayerName(client).."#00FF00 Te ha dado un Vehiculo #0B00FF("..getVehicleNameFromModel(id)..") ", plr, 0, 255, 0, true) outputChatBox("#00FF00Has dado a #FF0000" ..getPlayerName(plr).."#00FF00 Un Vehiculo #0B00FF(" ..getVehicleNameFromModel(id)..") ", client, 0, 255, 0, true) end end end addEventHandler("AdminPanel.giveVehicle", root, giveVehicle)
-
Try this should work function giveKey(player,command,arg) local account = getPlayerAccount(player) if account and not isGuestAccount(account) then local myAccountName = getAccountName(account) if arg then local playera = getPlayerFromName ( arg ) if playera then local pAccount = getPlayerAccount(playera) setAccountData (pAccount,"key"..myAccountName,true) outputChatBox("You have given a key to"..getPlayerName(playera),player) else outputChatBox("Cannot find player, make sure you use /giveKey 'player'") end end end end addCommandHandler ( "giveKey", giveKey ) function removeKey(player,command,arg) local account = getPlayerAccount(player) if account and not isGuestAccount(account) then local myAccountName = getAccountName(account) if arg then local playera = getPlayerFromPartOfName ( arg ) if playera then local pAccount = getPlayerAccount(playera) setAccountData (pAccount,"key"..myAccountName,false) outputChatBox("You have removed a key to"..getPlayerName(playera),player) else outputChatBox("Cannot find player, make sure you use /revokeKey 'player'") end end end end addCommandHandler ( "revokeKey", removeKey )
-
1) You Don't need to check if it's true because you already added it here in your table. 2) Try always to use local as much as you can. 3) it can be like this: local amount = ((plr == client) and 500) or 90 4) it can output some warnings because getText it can be a number or a string.
-
Here is what you need local inValidWeapons = {[38] = true , [34] = true} addEvent("AdminPanel.giveWeap", true) function giveWeap(plr, getText) if plr and isElement(plr) then if getText then if type(getText) == "string" then wep = getWeaponIDFromName(getText) elseif type(getText) == "number" then wep = getText end if inValidWeapons[wep] then outputChatBox("You can't give him this type of weapons",client,255,0,0) return end local ammo = ((plr == client) and 500) or 90 giveWeapon(plr, wep, 500, true) outputDebugString(ammo) outputChatBox("#FF0000" ..getPlayerName(client).."#00FF00 Te ha dado un Arma #0B00FF("..getWeaponNameFromID(wep)..") ("..ammo..") ", plr, r, g, b, true) end end end addEventHandler("AdminPanel.giveWeap", root, giveWeap)
-
@CodyL try always to optimize your codes as much as you can. addEvent("AdminPanel.giveWeap", true) function giveWeap(plr, getText) if plr and isElement(plr) then if getText then if type(getText) == "string" then wep = getWeaponIDFromName(getText) elseif type(getText) == "number" then wep = getText end if plr == client then giveWeapon(plr, wep, 500, true) else giveWeapon(plr, wepID, 90, true) end end end end addEventHandler("AdminPanel.giveWeap", root, giveWeap)