-
Posts
319 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Lpsd
-
Did some digging and put the following list together. They're most likely not listed anywhere on the wiki due to these animations only being available in certain versions of the SP (compatibility issues) - so whether they'll even work I don't know. I guess you can try. Block: "SEX" Anims: "SEX_1_P", "SEX_1_W", "SEX_1TO2_P", "SEX_1TO2_W", "SEX_2_P", "SEX_2_W", "SEX_2TO3_P", "SEX_2TO3_W", "SEX_3_P", "SEX_3_W", "SEX_3TO1_P", "SEX_3TO1_W", "SEX_1_P", "SEX_1_W", "SEX_1_CUM_P", "SEX_1_CUM_W"
-
https://wiki.multitheftauto.com/wiki/Animations Where are you seeing the "SEX" group as shown in your code (argument 2 - setPedAnimation)?
-
Double check your meta.xml, make sure this script is set to serverside.
-
Please disregard the information posted by @Rudransh You can't make a move-able gate in the map editor which only responds to a certain user or group. I'm afraid you're going to need to learn about Lua, or pay someone to do this for you. If you are new to scripting, I did recently advise someone on how to get started. See the link below! Good luck.
-
Hi Ridden! If you are new to scripting in general it may be useful for you to start off with learning the basics before trying to write stuff in MTA! Here are a few links and tutorials: https://www.tutorialspoint.com/lua/ (basic Lua tutorial) Once you are confident with the basics you can learn how the MTA system works, and how to make your own scripts. https://wiki.multitheftauto.com/wiki/Scripting_Introduction If you do not speak English well it may be worth posting in your regional subforum for more support https://forum.multitheftauto.com/forum/94-other-languages/ Have fun!
- 1 reply
-
- 2
-
Did you bother to read what the other two people told you? You'll need to ask for help on the SA-MP forum, not here.
- 8 replies
-
- lag
- singleplayer
-
(and 1 more)
Tagged with:
-
local timer_start = 129 --timer default starting value in seconds function split_string(inputstr, sep) if not inputstr then return false end if sep == nil then sep = "%s" end local t={} ; i=1 for str in string.gmatch(inputstr, "([^"..sep.."]+)") do t[i] = str i = i + 1 end return t end function resetTime() local min = math.floor( timer_start / 60 ) local sec = timer_start - (min * 60) setElementData(RoundTime1,"RoundTime1",min..":"..sec) end addCommandHandler("timereset", resetTime) RoundTime1 = createObject ( 964, 174.30078125, -58.458984375 +0, 1.578125 -1, 0, 0, 0 ) setTimer ( function() local time = split_string(getElementData (RoundTime1,"RoundTime1"), ":") if not time then --if seconds 0 or not created local min = math.floor( timer_start / 60 ) local sec = timer_start - (min * 60) setElementData(RoundTime1,"RoundTime1",min..":"..sec) else local min = tonumber(time[1]) local sec = tonumber(time[2]) - 1 --take a second off if sec == -1 then sec = 59 end if sec == 0 then --if 60 seconds past, take 1 from minute min = min - 1 end setElementData (RoundTime1,"RoundTime1",min..":"..sec) local timeObject = getElementData (RoundTime1,"RoundTime1") triggerClientEvent ( "getTimeBRO1",resourceRoot,timeObject) end end, 1000, 0 ) Try this, I noticed a problem with the original mins/secs maths which I copied from BrosS
-
local timer_start = 129 --timer default starting value in seconds function split_string(inputstr, sep) if not inputstr then return false end if sep == nil then sep = "%s" end local t={} ; i=1 for str in string.gmatch(inputstr, "([^"..sep.."]+)") do t[i] = str i = i + 1 end return t end function resetTime() local min = math.floor ( ( timer_start % 3600 ) /60 ) local sec = ( timer_start %60 /60*100 ) - (min * 60) setElementData(RoundTime1,"RoundTime1",min..":"..sec) end addCommandHandler("timereset", resetTime) RoundTime1 = createObject ( 964, 174.30078125, -58.458984375 +0, 1.578125 -1, 0, 0, 0 ) setTimer ( function() local time = split_string(getElementData (RoundTime1,"RoundTime1"), ":") if not time then --if seconds 0 or not created local min = math.floor ( ( timer_start % 3600 ) /60 ) local sec = ( timer_start %60 /60*100 ) - (min * 60) setElementData(RoundTime1,"RoundTime1",min..":"..sec) else local min = tonumber(time[1]) local sec = tonumber(time[2]) - 1 --take a second off if sec == -1 then sec = 59 end if sec == 0 then --if 60 seconds past, take 1 from minute min = min - 1 end setElementData (RoundTime1,"RoundTime1",min..":"..sec) local timeObject = getElementData (RoundTime1,"RoundTime1") triggerClientEvent ( "getTimeBRO1",resourceRoot,timeObject) end end, 1000, 0 ) I added a function for you, resetTime. Maybe you can figure out how to use this function once all players have died. I also cleaned up the logic of the timers too. Good luck!
-
RoundTime1 is a string value. On line 8 in your example you're trying to compare a string with 0. You could use something like this to split the RoundTime1 string by a certain character, in this case a colon. function split_string(inputstr, sep) if sep == nil then sep = "%s" end local t={} ; i=1 for str in string.gmatch(inputstr, "([^"..sep.."]+)") do t[i] = str i = i + 1 end return t end However, given the current logic of your script I can see a few problems with doing this. As I understand you're trying to make a timer which goes from 129 seconds, counts down to 0, then resets back to 129 and restarts. Something like this would be better. local timer_start = 129 --timer default starting value in seconds local min_tick = 0 function split_string(inputstr, sep) if sep == nil then sep = "%s" end local t={} ; i=1 for str in string.gmatch(inputstr, "([^"..sep.."]+)") do t[i] = str i = i + 1 end return t end RoundTime1 = createObject ( 964, 174.30078125, -58.458984375 +0, 1.578125 -1, 0, 0, 0 ) setTimer ( function() local time = split_string(getElementData (RoundTime1,"RoundTime1"), ":") if tonumber(time[2]) == 0 then --if seconds 0 or not created local min = math.floor ( ( timer_start % 3600 ) /60 ) local sec = ( timer_start %60 /60*100 ) setElementData(RoundTime1,"RoundTime1",min..":"..sec) else min_tick = min_tick + 1 local min = tonumber(time[1]) local sec = tonumber(time[2]) - 1 --take a second off if min_tick == 60 then --if 60 seconds past, take 1 from minute min_tick = 0 min = min - 1 end setElementData (RoundTime1,"RoundTime1",min..":"..sec) local timeObject = getElementData (RoundTime1,"RoundTime1") triggerClientEvent ( "getTimeBRO1",resourceRoot,timeObject) end end, 1000, 0 ) It's not pretty, but it should do the job. You should think about handling this on the clientside rather than using a triggerClientEvent every second. You could sync the timers onPlayerJoin for each client
-
@Fist oh, wasn't aware of that. Simple fix. Also weapon/damage needed to be the ID not name local damageTypes = { --table of damage types / weapons of which you want to adjust player damage dealt. {54, 50}, --damage type id/weapon id, -health to deal {50, 75}, {10, 500} } function customPlayerDamage(attacker, weapon, bodypart, loss) for i=1,#damageTypes do if weapon == damageTypes[i][1] then --if the current attacker's weapon/damage type is in damageTypes cancelEvent() --stops MTA handling of damage local playerHealth = getElementHealth(source) --get the players health (player is source of the event) setElementHealth(source, playerHealth - damageTypes[i][2]) --set it to current health minus the value in damageTypes end end end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), customPlayerDamage )
-
You could cancel the onPlayerDamage event and then deal damage based on attacker weapon / damage type. This should give you a decent idea. local damageTypes = { --table of damage types / weapons of which you want to adjust player damage dealt. {"Fall", 50}, --damage type, -health to deal {"Ranover", 75}, {"Dildo", 500} } function customPlayerDamage(attacker, weapon, bodypart, loss) for i=1,#damageTypes do if weapon == damageTypes[i][1] then --if the current attacker's weapon/damage type is in damageTypes cancelEvent() --stops MTA handling of damage local playerHealth = getElementHealth(source) --get the players health (player is source of the event) setElementHealth(source, playerHealth - damageTypes[i][2]) --set it to current health minus the value in damageTypes end end end addEventHandler ( "onPlayerDamage", getRootElement (), customPlayerDamage ) For the damageTypes table, you can refer to the attacker weapon and damage types on the wiki.
-
You'd be best off adding debug outputs to the shop system code, from there you'll be able to see which parts of the code are being called/executed and which parts aren't (the reason you can't buy a weapon) Not much we can do otherwise, unless someone has experienced this exact problem before.
-
shop2s.lua:75 Replace with this: pedCol = createColSphere (-336.8037109375, 1516.263671875, 75.359375, 3)
-
You might wanna re-read what he said,
-
shop1s.lua:105 Replace with this: pedCol = createColSphere (-336.56777954102, 1530.0159912109, 75.624549865723, 3) can you show us shop2s.lua?
-
I assumed you already had the team setup. This'll work local team = createTeam("Civil", 0, 0, 0) -- Change the team color if you want function joinUnem() if (getPlayerTeam(source) == false) then setPlayerTeam(source,getTeamFromName("Civil")) end end addEventHandler("onPlayerLogin",getRootElement(),joinUnem)
-
try function joinUnem() if (getPlayerTeam(source) == false) then setPlayerTeam(source,getTeamFromName("Civil")) end end addEventHandler("onPlayerLogin",getRootElement(),joinUnem) If that doesn't work then you'll need to show more of your code, such as team creation.
-
One of the few games I didn't end up playing on the N64, nonetheless it would be awesome to see it in MTA.
-
Use the "onClientBrowserDocumentReady" event to trigger it. https://wiki.multitheftauto.com/wiki/OnClientBrowserDocumentReady
-
I think MySQL is the best option, especially if you are working with large amounts of data. You might want to use setElementData for things which you only need to keep during a single session (data which doesn't have any need to be stored/recorded), and for data which you'd like to be synced across the server and all clients. Personally though I'd stick with MySQL and use events (triggerServerEvent/triggerClientEvent) to sync data between clients/server
-
"Use the 'upgrade' command to perform a basic upgrade of resources" Just type "upgrade" into the console and hit enter.
-
xref_garagedoor [id: 2885] It has a plain white side