Tox
Members-
Posts
77 -
Joined
-
Last visited
Everything posted by Tox
-
did you INSERT INTO first
-
you have to set setElementData function's last argument to true to sync with client setElementData (vehicle, "Cleaned", true, true) though i support using triggerClientEvent, i guess you can solve your problem with that
-
good job. everything looks perfect
-
you can either save the nickname with setAccountData or use SQL, if you want to get account name you can use getAccountName(acc)
-
depends on the which one you want to use but i'll just leave the both here; --1st way-- local jobtypes = {"Criminals", "Air Force", "Military", "Police"} local id = 0 local peds = { [createPed(0,2616.33, -1298.55, 14.23, 120)] = {0, 0}, [createPed(0,725.57, -1240.45, 13.53, 90)] = {0, 0}, } for ped, v in pairs(peds) do if ped then id = id + 1 if id >= #jobtypes then id = 1 end setElementData(ped,"jobPed",true) setElementData(ped,"jobnames",jobtypes[id]) setElementFrozen(ped, true) end end --2nd way-- local jobtypes = {"Criminals", "Air Force", "Military", "Police"} local int, old = 1, 1 local peds = { [createPed(0,2616.33, -1298.55, 14.23, 120)] = {0, 0}, [createPed(0,725.57, -1240.45, 13.53, 90)] = {0, 0}, } for ped, v in pairs(peds) do if ped then repeat int = math.random(#jobtypes) until int ~= old old = int setElementData(ped,"jobPed",true) setElementData(ped,"jobnames",jobtypes[int]) setElementFrozen(ped, true) end end
-
setElementData(source, "TEST1", searchForAPlayer[1]["TEST1"])
-
you can either set an id variable out of the chunk that increments when peds get jobs like --outside chunk local id = 0 --inside chunk id = id +1 if id >= #jobtypes then id = 1 end or you can repeat math.random until it gives another result and it's like this; --outside chunk local oldID = 0 --inside chunk local id = 1 repeat id = math.random (#jobtypes) until id ~= oldID oldID = id
-
because you define the marker variable every loop, i solved a similiar problem with storing markers in another table and create a loop to destroy local marker = {} for i = 1, #marker do if isElement (marker[i]) then destroyElement (marker[i]) end end for index, v in ipairs (robmarkers) do marker[index] = crea...
-
are you sure event "removePlayerAnim" triggers correctly? you can output a message to make sure it works
-
i am not sure but you should check isGuestAccount (account) before saving, that might prevent such an error
-
well, let's say i tried to make code smaller. but uh i thought it was synced, thanks
-
i guess i found the solution, weird tho. client side element vehicle doesn't pass to server
-
hello everyone, i am trying to make a garbage collector job i'm having some problems that i don't understand why. so my event "garbage.warpPedIntoVehicle" won't work and i don't know why, if i get it out of the chunk it works ok but with this it just returns false client local Garbage = {} local x, y, z = getMarkerPosition () localPlayer:setModel(309) Garbage.vehicle = createVehicle (408, x-2, y, z+2) inMission = true if isElement (Garbage.vehicle) then if triggerServerEvent("garbage.warpPedIntoVehicle", localPlayer, Garbage.vehicle) then outputChatBox ("aye") else outputChatBox ("nay2") end else outputChatBox ("nay") end server addEvent ("garbage.warpPedIntoVehicle", true) addEventHandler ("garbage.warpPedIntoVehicle", root, function (vehicle) outputChatBox ("aye2") warpPedIntoVehicle (client, vehicle) end )
-
you should create a loop to use if (element == peds[i]) then in your onPedClick function, because there is no i in that function
-
well, tried your way desperately but it didn't work
-
by my reckoning player's weapon data is deleted after dying and how do you think you're going to add onPlayerWasted event and check if player is not dead if isPedDead(source) then return end
-
--quit addEventHandler ("onPlayerQuit",root, function() if isPedDead(source) then return end local id = getPlayerData (source,"userinfo","userid") local x,y,z = getElementPosition(source) local r,g,b = source:getNametagColor() local int,dim = getElementInterior(source),getElementDimension(source) local money,bank = source:getMoney(), getPlayerData (source,"userinfo","userbank") local skin = getElementModel(source) sql.Exec ("UPDATE userinfo SET userX = ?, userY = ?, userZ = ?, userR = ?, userG = ?, userB = ?,userskin= ?, userdim = ?, userint = ?, usermoney = ?, userbank =?, userfirstjoin = ? WHERE userid = ? ",x,y,z,r,g,b,skin,int,dim,money,bank,0,id) for i = 1 , 12 do setPlayerData (source, "userinfo","userweapon_"..i,getPedWeapon(source,i) ) setPlayerData(source,"userinfo","userammo_"..i,getPedTotalAmmo(source,i)) end end ) --spawn addEventHandler ("onPlayerSpawn",root, function() local weapon = {} local wep,ammo = {},{} local data_weapon,data_ammo = {},{} for i = 1, 12 do data_weapon[i], data_ammo[i] = tonumber (getPlayerData (source,"userinfo","userweapon_"..i)),tonumber(getPlayerData (source,"userinfo","userammo_"..i)) wep[i],ammo[i] = data_weapon[i], data_ammo[i] giveWeapon (source,wep[i],ammo[i]) end end ) P.S setPlayerData and getPlayerData are custom functions of mine
-
hi, i am trying to save an SQL weapon data onPlayerQuit. it seems fine if you don't get killed, gives weapons when spawning etc. once you die and after spawn, it gives weapons again but when player quits and connects again data gets lost for some reason. do you know why it could be?
-
btw, i couldn't find a way to insert row 0 now this is a new problem //edit:fixed
-
much appreciated, thanks a lot. guess the problem was defining rows
-
so you mean, i should do it without a loop? e.g rowHandgun = ... rowShotgun = ...
-
hi there, i'm having a problem with gridlist. hope you can help. i want to order lists by column but it starts on the next row every different column and it shows something like this; here's my part of code; local wepsTbl = { --wep name, wep id [1] = {{"Deagle", 24}, {"Pistol",22},{"Silenced",23}}, [2] = {{"Shotgun",25}, {"Spaz-12",27}, {"Sawed-off",26}}, [3] = {{"Uzi",28},{"Tec-9",32},{"MP5",29}}, [4] = {{"M4",31},{"AK47",30}}, [5] = {{"Country Rifle",33}, {"Sniper Rifle",34}}, [6] = {{"RPG",35},{"Heat-Seaking RPG",36},{"Flamethrower",37},{"Minigun",38},{"Purple Dildo",10},{"Short Dildo",11}, {"Vibrator",12}, {"Flowers",14}, {"Cane",15}}, [7] = {{"Golf Club",2},{"Nightstick",3},{"Knife",4},{"Baseball Bat",5},{"Shovel",6},{"Pool Cue",7},{"Katana",8},{"Chainsaw",9}} } for k,_ in ipairs (wepsTbl) do for __,val in ipairs (wepsTbl[k]) do local wepRow = guiGridListAddRow (wepGrid) guiGridListSetItemText (wepGrid,wepRow,k,val[1],false,false) guiGridListSetItemData (wepGrid,wepRow,k,val[2]) outputChatBox(wepRow) end end
-
is the main chat you want names to appear or just teamchat?
-
you can make a demo video for me to see?, it may be useful to me. oh, limited internet sorry. but i can send you the script through PM if you want
-
thank you both, @#RooTs i don't really see what's going on in that video @IIYAMA i thought about local weapon = getPedWeapon(player,index)-- index = slot but i needed to state certain slots so i insert them in table, thank you for suggestion though. isWeaponLimited is good idea thank you for that. i've set timer 500 ms and so far we have no problem, sir. thank you