Jump to content

Ryancit2

Members
  • Posts

    266
  • Joined

  • Last visited

Everything posted by Ryancit2

  1. Ryancit2

    ammo

    Make use of tables like this: maxAmmo = { ["m4"] = 5000, ["mp5"] = 9000 } -- And use like this: if ammo >= maxAmmo[wep] then setWeaponAmmo(player, wep, maxAmmo[wep]) end -- server sided.
  2. You'll need to remove newer functions from your script files plus someone will barely play on v1.0's server as there are no 1.0 servers anymore.
  3. You can try these: https://community.multitheftauto.com/index.php?p= ... ls&id=6071 https://community.multitheftauto.com/index.php?p= ... s&id=10487
  4. Good job, agar koi problem hui to batana.
  5. Iss mein getRandomPlayer() aik server-only function hai jo ke client side par use nahi ho sakta, tum ye try karo: Client.lua function vipCarHandler() local x, y, z = getElementPosition (localPlayer) local veh = createVehicle (432, x, y, z) outputChatBox ("You've been given a tank") end addEventHandler("onClientGUIClick", vipcar, vipCarHandler, false) Pehli baat, tum ne localPlayer ko getRandomPlayer kyun kiya? getRandomPlayer koi bhi player pick karega, na ke jis ne button press kiya. Dusri baat, "onClientGUIClick" sirf client side ki event hai, is ko server par use nahi kiya ja sakta. Tisri baat, localPlayer ko define karnay ki zaroorat nahi hai, localPlayer() aik predefined function hai jo ke button press karnay wala client hota hai, in GUI cases.
  6. tum ne wahan reply nahi kiya to mujhay laga tum ne dekha hi nahi.
  7. Well than i'd say most of the functions would be deprecated so you should search for some other gamemode same as COD or BF or some World War game modes (if there are any?)
  8. Maine ladai nahi ki, maine sorry bola hai aur ccv ko aik tip di hai ke smaller code = better performance.
  9. Main aap ki baat se agree karta hoon.
  10. Serverside pe karne ka aik faida hai ke kisi ko bhi client cache se complete script nai milti. Agar aap saari cheez hi client side pe karo gay to koi bhi aap ki script ko easily steal kar le ga. Dafa maro stealers ko, dil bara rakho + compile bhi to kar saktay ho, maine jahan tak note kiya hai, script jitni choti ho utni sahi rehti hai, phir chahay wo sari client ho ya server. Also, agar meri baatein bohat offended lageen to sorry lekin agli baar dheyan rakhna, kisi ki script mein koi bug ho to us par hasnay ke bijaye usay sahi karwana, mujhay tumhara 'Lol, lol, lol, lol' bohat offended laga tha lekin tum ne apni post edit kar ke sahi kar li, so maine bhi sorry bol diya Koi baat nahi yar, anytime. btw tum ne wo OGClogin check kiya?
  11. lol ye maine test nahi ki thi maine sirf Robin ki di hui ko edit kiya tha jis main ye bug reh gya, ab apni dekho aur meri try karo, apni ko dekho 48 lines long script hai jabke meri sirf 20 lines long, aur serverside ki zaroorat hi nahi hai, meri wali clientside par hi chalti hai.
  12. Mene aap ki script ko check nai kiya lekin aap ki script mein zaroor koi na koi error ho ga, aap khudi check kar ke dekh lo aur phir bata dena ke chali ya nai, lekin mere 100% work karti hai. Aap ko kuch cheezeu server side bhi karni parti hain bhai aur events ko jaga jaga trigger karna parta hai phir aap ki script smoothly chalti hai. Phir smoothly nahi balkay server performance ko kharab karti hain: Pehli baat, aap ka code raucously lengthy hai, in baton main: - Hum addCommandHandler ko client side main bhi daal saktay hain, is se hamain server-to-client request ki zaroorat nahi hai. - Hum setElementHealth wala function bhi client side par daal saktay hain kyun ke ye shared function hai + client-to-server request ki zaroorat nahi hai. - Extra functions like closeGUI ko bhi serverside se call ki zaroorat nahi ho gi. - Small tip: getLocalPlayer() ab old-age ho gya hai, is ki short form localPlayer hai jo kay ab zyada use hoti hai, dono same hain. Also, aap ko mujhay hai 'smoothly' wali batein sikhao hi na, mera ecripting experience shayad aap se kam ho lekin maine aaj tak kisi se help nahi li aur meri scripts dekhi jayen to server ko 0.1% se zyada use nahi karti. Haan meri script nahi chali ho gi kyun ke ye setElementHealth(localPlayer, 200) karti hai, is ko 100 karo aur check karo, phir sikhana mujhay scripting.
  13. @ccv kiya aap mujhay batayen gey ke debugscript ne kiya error diya hai?
  14. Try this: function getAllPlayers() local pTable = {} local teams = getElementsByType("team") if (not teams) then return end for k, v in pairs(teams) do local plrs = getPlayersInTeam(v) if (not plrs) then return end pTable[getTeamName(v)] = plrs end return pTable end You can call this function in other functions by typing getAllPlayers() and it will return a teable like this: teams ={ ['teamName'] = {plr, plr, plr, plr}, ['otherTeam'] = {plr, plr, plr, plr} } -- Use it like this: for k, v in pairs(teams) do for i, d in pairs(v) do outputChatBox("Player "..getPlayerName(d).." is in team "..k) end end or i made another function like this, it contains players without team names: function getAllPlayersV2() local pTable = {} local teams = getElementsByType("team") if (not teams) then return end for k, v in pairs(teams) do local plrs = getPlayersInTeam(v) if (not plrs) then return end for i, d in pairs(plrs) do pTable[#pTable+1] = d end end return pTable end You can call this function in other functions like getAllPlayersV2() and will get table like this: teams = { [1] = plr, [2] = plr, [3] = plr, [4] = plr } -- And use it like this: for k, v in pairs(teams) do outputChatBox(getPlayerName(v)) -- Will output players per team in a row. end
  15. If export gives weapon, then follow accurate params and do it.
  16. 1 hour = (1 sec x 60) x 60
  17. Ryancit2

    ammo

    Try this: addEventHandler("onPlayerVehicleEnter", getRootElement(), function(vehicle, seat, jacked) if (getElementModel(vehicle) == 433) then local wep = getPedWeapon(source) or 0 if (wep == 0 or wep == 1 or wep == 10 or wep == 11 or wep == 12) then -- If its a melee. outputChatBox("You can not have weapon ammo for "..getWeaponNameFromID(wep), source, 200, 0, 0) return end if tonumber(wep) then giveWeapon(source, wep, 200) end outputChatBox("You have been given 200 ammo for "..getWeaponNameFromID(wep), source, 255, 255, 0) end end)
  18. It is a huge code, better ask its creator, maybe in resource comments?
  19. Try this: hp_wnd = guiCreateWindow(321, 197, 154, 140, "HEALTH PANEL", false) guiWindowSetSizable(hp_wnd, false) hp_btn = guiCreateButton(10, 22, 134, 108, "GIVE HEALTH", false, hp_wnd) guiSetVisible(hp_wnd, false) bindKey ("F2", "down", function () local state = (not guiGetVisible(hp_wnd)) guiSetVisible(hp_wnd, state) showCursor(state) end ) function setHP() local hp = getElementHealth(localPlayer) -- Get current HP. if hp >= 100 then hp = 100 end -- A small fix for players with greater than 100 HP, like some have 200. setElementHealth(localPlayer, hp+100) outputChatBox("Your HP has been increased by 100.", 0, 200, 0) end addEventHandler("onClientGUIClick", hp_btn, setHP, false)
  20. Its because mechanic GUI is being created but AFTER this function at line 393, mechanic GUI is created in some other function which is not called before line 393.
  21. Try this function: if getPedWeapon(thePlayer) == 49 then
  22. By the way its for loop. Also, you can add timers under acc name key aswell, like this: accTimers = { ["account"] = setTimer( ... ) } And then you can loop through table.
  23. What exactly you are stuck at? Plus, what is the 'source' of this event? Since it is a manually triggered Event, you should add the specific Element instead of source (at Line#5). Also, tell us /debugscript 3 output, if there is any bug.
  24. jee haan, aaj ke baad, iss par report ki jaye gi, maine MTA Team se confirm kiya hai. Agar aap thori thori English likhein to koi problem nahi hai like kuch words in a sentence.
  25. I'd prefer not to call elementData so often, instead make tables as acc names = keys and times as values of accounts, then update table on regular intervals and then check whether the time has reached or not, something like this: timeCache = { --["acc"] = time, } function updateTime(acc) timer = setTimer(function(acc) timeCache[acc] = timeCache[acc] + 5, 5000, 0) -- Will update after every 5 seconds, though timer won't be killed, no need. end -- Now call updateTimer(acc) function in other functions but before that, make a check like this: if timeCache[acc] >= 3600 then timeCache[acc] = 0 return end Though this just as idea, showing how you should use tables to handle timers.
×
×
  • Create New...