-
Posts
667 -
Joined
-
Last visited
-
Days Won
4
Everything posted by Mr.Loki
-
No prob
-
You can block the player from entering the vehicle by canceling the onVehicleStartEnter the example on that page is just what you are looking for with just a few tweaks
-
To replace the sound fully you would need to disable each weapon's default sound with setWorldSoundEnabled to figure out which group and index you need to disable for the weapon sounds you can do the following: start runcode /crun setDevelopmentMode(true) /debugscript 3 /showsound shoot your weapon and it will pop up in the debug window
-
projectile How to change a projectile's blip color?
Mr.Loki replied to Lord Henry's topic in Scripting
A table containing the element -
Source isn't defined in your function use a loop to get each player in the server with getElementsByType
-
function spawnpanel() local acc = getPlayerAccount(source) if getAccountData(acc, "FirstLoginKek") == false then --wrong syntax triggerClientEvent(acc, "spawnpanel") setAccountData(acc, "FirstLoginKek", true) outputChatBox("works", acc, 255, 0, 0) end end addEventHandler("onPlayerLogin", getRootElement(), spawnpanel) You can use either: If getAccountData(account,"key") == false then Or If not getAccountData (account,"key") then
-
I don't see anything being indexed or any var called elementData at line 979 or anywhere in the code are you sure this is the right script?
-
How are you saving the player's hunger
-
local modifier = 1 local day = getRealTime().weekday if day == 0 or day == 6 then -- 0 = sun 6 = sat modifier = 2 end local experiences = math.random(200,300)*modifier setElementData(killer,"experience",getElementData(killer,"experience") + experiences)
-
projectile How to change a projectile's blip color?
Mr.Loki replied to Lord Henry's topic in Scripting
Try this: getAttachedElements setBlipColor -
@MIKI785 Yeah I know. I'm not saying that he actually did it but just as a tip. For instance where you have those function with multiple events attached to it.
-
@Function you can't destroy an element which does not exist. Maybe read the whole topic next time because Fist explains why.
-
You do not need the position. Read the wiki page about the function and know what the arguments are. Also a pro tip: It's a bad idea to name your functions the same name as MTA's functions because you will create an infinite loop where the function calls itself. Use a bit of diversity(but not too much) when creating the names.
-
That was 1 of the problems I came across when I made my youtube script. The problem is youtube's site, not the script because if you try it with this forums it will work perfectly. Maybe you can check either of my youtube scripts and probably find the solutions and get some tips.
-
Use getRealTime().timestamp this will return the current date of the client/server depending on which u run this function on as a UNIX timestamp. Google UNIX Timestamp converter to have a better understanding of what it is. Since we don't want players to adjust their time on their PC so they have infinite VIP we will make this function server sided. addEvent("addVIP",true) addEventHandler("addVIP",getRootElement(),function(source) local account = getPlayerAccount(source) local accName = getAccountName(account) aclGroupAddObject(aclGetGroup("VIP"),"user."..accName) -- This returns a table of the time including hour, minutes, seconds etc... -- we just need the timestamp in the table so we use ".timestamp" which is the current date in seconds (UNIX timestamp). local currentDate = getRealTime().timestamp -- now we must store that data (currentDate) into the player's account on a key called "VIPPurchaseDate". setAccountData("VIPPurchaseDate", currentDate) end) function checkPlayersVIP( ) -- Now we make a loop through all the players in the server. local plrs = getElementsByType'player' for i=1,#plrs do -- We get the player's account and their VIP purchase date. local account = getPlayerAccount( plrs[i] ) local purchaseDate = getAccountData( account, "VIPPurchaseDate" ) -- We now check if they have purchased vip on the account. if purchaseDate then -- We get the current time of the server, local currentDate = getRealTime().timestamp -- and minus the player's purchased date from it. 3600 seconds = 1 hour so we just multiply it by 24 to get a day. if currentDate - purchaseDate >= 3600*24 then -- If it is greater than or equals to 24 hours we remove the vip from the player's account. aclGroupRemoveObject( aclgaclGetGroup("VIP"), "user."..getAccountName(account) ) outputChatBox( "the message you may want to tell the player that his VIP has finished", plrs[i], 255, 100, 100 ) setAccountData("VIPPurchaseDate", false) end end end end -- we add a timer to check the players every minute of their VIP status setTimer( checkPlayersVIP, 60000, 0 ) P.S: Please use the code <> button when posting code. It just makes things much easier to read and identify.
-
"upgrade VCTest"
-
onClientGUIDoubleClick for GUI elements. onClientDoubleClick for dx
-
it's an event you attach it to your browser element like how you attached the onClientClick event to the cinema button. function geturl() guiSetText(addressBar,getBrowserURL(source)) end addEventHandler("OnClientBrowserNavigate",theBrowser, geturl) This event will be called every time the browser navigates to a different page.
-
https://wiki.multitheftauto.com/wiki/OnClientBrowserNavigate
-
https://wiki.multitheftauto.com/wiki/Shader_examples Scroll down to ped morph.
-
Note: To prevent memory leaks, ensure each call to xmlLoadFile has a matching call to xmlUnloadFile Don't forget to unload your XML files after loading them. Also, I don't think you should be rendering XML function... bad performance. Store the data from the XML in a table or var and render that