proracer
Members-
Posts
499 -
Joined
-
Last visited
Everything posted by proracer
-
Hmm... can you use tostring?
-
Sorry, I don't get you quite well with that.. but the error you are getting is because the variable you are using in string.gsub is a number value not a string value. Maybe it's better if you can post your code here?
-
If I understood you correct: addEventHandler ( 'onPlayerChat', root, function ( message, messageType ) if ( messageType ) == 0 then if ( message ) == 'GNR45' then cancelEvent ( ) outputChatBox ( message:gsub ( 'GNR', '' ) ) outputServerLog( "CHAT: " .. getPlayerName ( source ).. ": " .. message ) end end end ) I didn't tested yet.
-
You can use (return string.gsub) , right?
-
So you can use executeSQLInsert then executeSQLUpdate, if I'm not wrong?
-
Yes. https://wiki.multitheftauto.com/wiki/GetRootElement It's for the people who are too lazy.
-
Yes like Solidsnake said, just change getRootElement to resourceRoot / getResourceRootElement(getThisResource)
-
I think that is client-side script, also can you show the whole code not just the part?
-
Author's: for 1,19 do Volk-rus's: for i = 1,19 do
-
You added it in mtaserver.conf, what? You must create folder and put it in resources folder, in that created folder put your meta.xml and script files.
-
Try this: addEventHandler ( 'onClientResourceStart', resourceRoot, function ( ) for i,v in ipairs ( getElementsByType ( 'player' ) ) do setWaterColor ( 255, 128, 0 ); setSkyGradient ( 60, 100, 196, 136, 170, 212 ); end end ); Also nobody takes requests so I think nobody will make your gui, sorry try it yourself.
-
You can read about it here: http://lua-users.org/wiki/ForTutorial OR http://www.lua.org/pil/4.3.4.html and http://www.lua.org/pil/4.3.5.html Good luck.
-
Maybe you can try look at resource: editor_main
-
They can be used dynamically, like example for small real time clock, gui can't do that - gui is static.
-
Can you try this: dxDrawImage( 0, 0, 960, 540, "./ressources/gfx/hud.bmp", 0, 0, 0, tocolor ( 0, 0, 0, 0 ) )
-
Press "PrintScreen" on keyboard if you have it and paste it in picture editor like Paint or something.
-
You can use createObject if I'm not wrong..?
-
I think it's impossible, can't you just copy it from other resource?
-
It should work, can you show us the meta file?
-
I can tell you that SQLite is alot easier then MySQL in my opinion and still efficient and good, so I like it more.
-
How to set that you download a resource before the other?
proracer replied to xXNemesiSXx's topic in Scripting
Try this, but I didn't tested and I think it won't work.. try to fix somehow if you can, I'm just too lazy to test. -- USEFUL FUNCTION: // [url=https://wiki.multitheftauto.com/wiki/GetTimestamp]https://wiki.multitheftauto.com/wiki/GetTimestamp[/url] // Big thanks to author! -- function getTimestamp(year, month, day, hour, minute, second) -- initiate variables local monthseconds = { 2678400, 2419200, 2678400, 2592000, 2678400, 2592000, 2678400, 2678400, 2592000, 2678400, 2592000, 2678400 } local timestamp = 0 local datetime = getRealTime() year, month, day = year or datetime.year + 1900, month or datetime.month + 1, day or datetime.monthday hour, minute, second = hour or datetime.hour, minute or datetime.minute, second or datetime.second -- calculate timestamp for i=1970, year-1 do timestamp = timestamp + (isLeapYear(i) and 31622400 or 31536000) end for i=1, month-1 do timestamp = timestamp + ((isLeapYear(year) and i == 2) and 2505600 or monthseconds[i]) end timestamp = timestamp + 86400 * (day - 1) + 3600 * hour + 60 * minute + second timestamp = timestamp - 3600 --GMT+1 compensation if datetime.isdst then timestamp = timestamp - 3600 end return timestamp end function startAndStopTheResource ( ) local theResource = getResourceFromName ( 'editor_main' ) local start = startResource ( theResource ) local stop = stopResource ( theResource ) local startAt = getTimeStamp ( year, month, day, hour, minute, second ) if ( startAt ( hour ) ) == 12 then start else return end if ( startAt ( hour ) ) == 0 then stop else return end end addEventHandler ( 'onResourceStart', resourceRoot, startTheResource ) -
Try this: enabled = true GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(150,185,457,363,"Gui De Sonidos",false) guiSetVisible(GUIEditor_Window[1],false) GUIEditor_Button[1] = guiCreateButton(21,32,99,35,"Fail",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(19,79,102,34,"ayuwoki",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(20,130,100,33,"Hola",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(18,177,100,34,"Cuack",false,GUIEditor_Window[1]) GUIEditor_Button[5] = guiCreateButton(19,219,100,34,"Mario",false,GUIEditor_Window[1]) GUIEditor_Button[6] = guiCreateButton(21,261,100,34,"Disco",false,GUIEditor_Window[1]) GUIEditor_Button[7] = guiCreateButton(133,32,100,34,"Membrillo",false,GUIEditor_Window[1]) GUIEditor_Button[8] = guiCreateButton(134,79,100,34,"aweonao",false,GUIEditor_Window[1]) GUIEditor_Button[9] = guiCreateButton(133,128,100,34,"vacio",false,GUIEditor_Window[1]) GUIEditor_Button[10] = guiCreateButton(133,178,100,34,"vacio",false,GUIEditor_Window[1]) GUIEditor_Button[11] = guiCreateButton(131,226,100,34,"vacio",false,GUIEditor_Window[1]) GUIEditor_Button[12] = guiCreateButton(131,270,100,34,"vacio",false,GUIEditor_Window[1]) GUIEditor_Button[13] = guiCreateButton(9,309,435,45,"CERRAR",false,GUIEditor_Window[1]) GUIEditor_TabPanel[1] = guiCreateTabPanel(35,-668,5,600,false,GUIEditor_Window[1]) GUIEditor_Tab[1] = guiCreateTab("Tab",GUIEditor_TabPanel[1]) GUIEditor_Label[1] = guiCreateLabel(271,37,165,257,"No agas Spam ",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[1],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false) guiSetFont(GUIEditor_Label[1],"sa-header") GUIEditor_Image[1] = guiCreateStaticImage(243,134,204,120,"images/mtalogo.png",false,GUIEditor_Window[1]) addEventHandler("onClientGUIClick",getRootElement(), function () if (source == GUIEditor_Button[13]) then guiSetVisible(GUIEditor_Window[1],false) showCursor(false) elseif (source == GUIEditor_Button[1]) then if enabled then enabled = false triggerServerEvent("sendSound",getLocalPlayer(),"fail.mp3") elseif (source == GUIEditor_Button[2]) then if enabled then enabled = false triggerServerEvent("sendSound",getLocalPlayer(),"ayuwoki.mp3") elseif (source == GUIEditor_Button[3]) then if enabled then enabled = false triggerServerEvent("sendSound",getLocalPlayer(),"hola.mp3") elseif (source == GUIEditor_Button[4]) then if enabled then enabled = false triggerServerEvent("sendSound",getLocalPlayer(),"cuack.mp3") elseif (source == GUIEditor_Button[5]) then if enabled then enabled = false triggerServerEvent("sendSound",getLocalPlayer(),"mario.mp3") elseif (source == GUIEditor_Button[6]) then if enabled then enabled = false triggerServerEvent("sendSound",getLocalPlayer(),"disco_pogo.mp3") elseif (source == GUIEditor_Button[7]) then if enabled then enabled = false triggerServerEvent("sendSound",getLocalPlayer(),"membrillo.mp3") elseif (source == GUIEditor_Button[8]) then if enabled then enabled = false triggerServerEvent("sendSound",getLocalPlayer(),"aweonao.mp3") enabled = false setTimer(setState,60000,1) else outputChatBox("Solo Puedes Hacerlo cada 60 Segundos",255,0,0) end end end) function setState() enabled = true end addEvent("returnSound",true) addEventHandler("returnSound",getRootElement(), function (sound) playSound("files/".. tostring(sound),false) end) function bindIt ( ) bindKey ( 'F7', 'down', showIt ) end addEventHandler ( 'onClientResourceStart', resourceRoot, bindIt ) function showIt ( ) isVisible = guiGetVisible ( GUIEditor_Window[1] ) if (isVisible) then guiSetVisible ( GUIEditor_Window[1], false ) showCursor ( false ) end if (not isVisible) then guiSetVisible ( GUIEditor_Window[1], true ) showCursor ( true ) end end
-
Example: inhouse = createMarker ( 0.0, 0.0, 0.0, 'corona', 2.0, 255, 128, 0, 255 ) -- Change the first 3 parameters to your co-ordinates function MarkerHit ( hitElement ) if ( source ) == inhouse then local x,y,z = getElementPosition ( inhouse ) setElementPosition ( hitElement, x, y + 5, z ) local rotX, rotY, rotZ = getElementRotation ( hitElement ) setElementRotation ( hitElement, rotX, rotY, rotZ + 180 ) end end addEventHandler ( 'onMarkerHit', inhouse, MarkerHit )
-
Create a marker or a colshape and when an element hits it play a sound.
