-
Posts
18 -
Joined
-
Last visited
Details
-
Location
Emerald Hill
-
Occupation
Professional Scripter
-
Interests
GTA:SA, Multi Theft Auto, Lua
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
PeaceBomb99's Achievements
Square (6/54)
5
Reputation
-
You could do something like this addEventHandler("onPlayerCommand", root, function(cmd) if cmd == "register" then local accounts = getAccountsBySerial(getPlayerSerial(source)) if #accounts >= 1 then outputChatBox("You already own one or more accounts!", source) cancelEvent() end end end ) Then I suggest you to show them the account names and add the ability to delete them.
-
Can you add support for 64-bit please?
-
@Pirulax http://lua-users.org/wiki/TablesTutorial
- 10 replies
-
- lua
- lua tables
-
(and 2 more)
Tagged with:
-
I'm pretty sure you can't put words in the typing field of the chatbox. You must create your own chatbox if you want to do that kind of stuff.
-
There's a function for it https://wiki.multitheftauto.com/wiki/CreateLight
-
addEventHandler("onClientKey", root, function(key, pressed) if pressed then outputChatBox(key) end end ) Or for characters you can try addEventHandler("onClientCharacter", root, function(c) outputChatBox(c) end )
-
You have to escape them with % local str = "[lol] ok[]." local str = str:gsub("[%[%]]","") print(str)
- 1 reply
-
- 1
-
You have to loop through your teams local teams = {"Team1", "Team2", "Team3", "Team4"} function RadioChat(thePlayer, _, ...) local message = table.concat ( { ... }, " " ) for i=1, #teams do local team = getTeamFromName(teams[i]) -- teams[i] means, teams[1], teams[2], teams[3], teams[4] (returns the value for each) if team then local name = getPlayerName(thePlayer) local players = getPlayersInTeam ( theTeam ) for playerKey, playerValue in ipairs ( players ) do outputChatBox("(*RADIO*) " .. getPlayerName ( thePlayer ) .. " #ffffff"..message, playerValue, 0, 0, 255, true) end end end end Basically does for each value in teams table execute the code. Hope this helps.
-
Why is it compiled? you didn't answer the first time. You said it contains server update stuff, but you didn't say why you compiled it. Just post the decompiled version so there won't be any issues.
-
https://www.tutorialspoint.com/lua/lua_tables.htm https://en.wikibooks.org/wiki/Lua_Programming/Tables http://lua-users.org/wiki/TablesTutorial http://www.troubleshooters.com/codecorn/lua/luatables.htm Literally everything explained on these websites
-
This may be what you're looking for local secs = getTimerDetails(timers[source])/1000 local remaining = string.format("%.1d hours %.1d minutes and %.1d seconds", secs/(60*60), secs/60%60, secs%60)
-
What do you mean, and why is it compiled?
-
@Emix Tickcount could work, but you can also just use the setTimer() func. Are you looking for a global timer or one on a player basis? Here's two examples: local timers = {} function weaponsKit() if isTimer(timers[source]) then -- check table for player timer local remaining = math.ceil(getTimerDetails(timers[source])/1000) outputChatBox("Sorry, you can only take this item every 10 seconds! Please wait "..remaining.." more seconds") else local account = getPlayerAccount ( source ) local accName = getAccountName ( account ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then setElementData(source, "MAX_Slots", 200) setElementData(source, "M4", 1) outputChatBox("#00ff00Weapon VIP #ffffffitems.",source, 255, 255, 255, true) else outputChatBox("#ff0000[Error] #ffffffYou don't have VIP!",source, 255, 255, 255, true) end timers[source] = setTimer(function() -- define timer here to table and remove it after 10 seconds timers[source] = nil end, 10000, 1) -- 10000 ms (10 secs) end end addEvent("onWeaponKitTake", true) addEventHandler("onWeaponKitTake", getRootElement(), weaponsKit) Global timer: local timer; function weaponsKit() if isTimer(timer) then -- check for timer local remaining = math.ceil(getTimerDetails(timers[source])/1000) outputChatBox("Sorry, you can only take this item every 10 seconds! Please wait "..remaining.." more seconds") else local account = getPlayerAccount ( source ) local accName = getAccountName ( account ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then setElementData(source, "MAX_Slots", 200) setElementData(source, "M4", 1) outputChatBox("#00ff00Weapon VIP #ffffffitems.",source, 255, 255, 255, true) else outputChatBox("#ff0000[Error] #ffffffYou don't have VIP!",source, 255, 255, 255, true) end timer = setTimer(function() -- initiate timer and get rid of it after 10 secs timer = nil end, 10000, 1) -- 10000 ms (10 secs) end end addEvent("onWeaponKitTake", true) addEventHandler("onWeaponKitTake", getRootElement(), weaponsKit) Hope this helps. EDIT: Oh my bad, didn't see your post @idarrr! Well.. you can never have too many examples Pick whichever one makes the most sense to you.
-
Pretty nice of you to release this. I can tell by looking at the code that you've put in a lot of time and effort into this. I'm just wondering though, could you tell me what code.lua is/does? The file seems to be compiled.