Gallardo9944
Members-
Posts
442 -
Joined
-
Last visited
Everything posted by Gallardo9944
-
You could use JSON + fetchRemote from Twitter API: https://dev.twitter.com/docs/api/1/get/search
-
setfenv doesn't seem to work with MTA, does it?
-
@Tete omar, that totally depends on the tastes, I prefer the full functions
-
keep in mind, that addEventHandler("onResourceStart", getRootElement(), M1Garand ) will trigger the function EVERY single time ANY resource starts. You'd better do it like that: addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), M1Garand ) Then it will be triggered only when the original resource starts.
-
What's the actual problem?
-
You are welcome.
-
Attempt to Index global 'mysql' (a nil value)
Gallardo9944 replied to Controlled's topic in Scripting
are you sure you've got "mysql" resource running and with exported functions? -
i just created another resource which handles that. The code looks like: local objects = { } local _createObject = createObject -- save the original function function createObject(id,x,y,z,rx,ry,rz,islod) -- replace the original one if not id or not x or not y or not z then return false end local rx = rx or 0 local ry = ry or 0 local rz = rz or 0 local object = _createObject(id,x,y,z,rx,ry,rz,islod) -- use the old function if object then table.insert(objects,object) return object -- Don't forget to return the info of the original one end end function loadCode(content) local loaded = loadstring(content) local ex = pcall(loaded) if ex then outputChatBox("loaded the code") end end function unloadCode() for i,v in ipairs(objects) do if isElement(v) then destroyElement(v) end end end
-
local errorString = nil -- WRONG, it's not a string. local correctString = "nil" -- CORRECT, has " " local info = string.gsub(correctString,"n","y") -- info will be "yil" - no errors occur local infoWrong = string.gsub(errorString,"1","2") -- will return "string expected, got nil" error. "errorString" is not a string
-
I suppose you are spectating the player when one is too far from another. I experienced such problem, but i honestly don't know how i got rid of it.
-
admin panel WILL open no matter what, only if you change the admin panel code. Set your element data to true when it's opened and to false when it isn't and check it in the admin panel code (can't exactly say what file, but you can find it with "bindKey" and the function inside it)
-
addEventHandler( "onVehicleStartEnter", root, function ( enteringPlayer ) local skin = getElementModel ( enteringPlayer ) if ( getElementModel ( source ) == 520 or getElementModel ( source ) == 425 ) and not ( skin == 287 or skin == 217 ) then cancelEvent( ) outputChatBox("You must be in Army to enter the vehicle!",enteringPlayer,255,0,0,true) end end ) Because you use "getElementModel ( source ) == 520 or 425", but it doesn't check the model for both 520 and 425. It checks if the model is 520 and if a VALUE 425 exists (it always does though)
-
toggleControl (chatbox, false) -- WRONG toggleControl("chatbox",false) -- CORRECT
-
dxSetShaderValue(blackWhiteShader, "ScreenTexture", screenSource)
-
in fact, if you're creating something clientside, the actual objects are stored and created clientside, thus resulting into a client lag (depending on the map size). If you perform the same thing serverside, the client will have less impact, but the server might slow down for 1-3 seconds (depending on the map size agaib), but the objects removal might also be very slow (destroyElement on about 8000 objects might take 5 seconds of frozen server)
-
It's in mapmanager resource.
-
"freeroam" is a resource which manages your F1 menu, not the actual gameplay. "play" is in charge of it. Check if it has some sort of skin-changing part in it. EDIT: yeah, remove "repeat until setElementModel(player,math.random(312))" from it.
-
myFont = dxCreateFont( "segoeui.ttf", 20 ) This one creates a font where scale of 1 will make it use 20 PTs size. Change 20 to any other value to use as a scale of 1, change the scale to make it change the size without touching the font.
-
Should be fine. Untested. local x, y = guiGetScreenSize() local scale = y/900 GUIEditor.button[1] = guiCreateButton(446*scale, 450*scale, 173*scale, 54*scale, "Login", false) GUIEditor.button[2] = guiCreateButton(667*scale, 450*scale, 173*scale, 54*scale, "Registrati", false) GUIEditor.label[1] = guiCreateLabel(461*scale, 261*sscale, 58*scale, 18*scale, "Username", false) GUIEditor.label[2] = guiCreateLabel(461*scale, 378*scale, 58*scale, 18*scale, "Password", false) GUIEditor.edit[1] = guiCreateEdit(648*scale, 270*scale, 187*scale, 27*scale, "", false) GUIEditor.edit[2] = guiCreateEdit(648*scale, 378*scale, 187*scale, 27*scale, "", false)
-
I imagine 446*1280 if your resolution is 1280x720, lol. You shouldn't use 2 scale values cause if a screen is not widescreen, then the elements will be stretched out.
-
Don't copypaste, but try your own calculations + report if any debug errors appear.
-
showPlayerHudComponent("clock", false) local x,y = guiGetScreenSize() function updateHud() --outputChatBox("function test") -- It works local realtime = getRealTime() local hour = realtime.hour local minute = realtime.minute dxDrawText("00:00",x - 100,y/2 - 56,x,y) -- Find your preferred position. end --function timeHudF() addEventHandler("onClientRender", getRootElement(), updateHud) --end --addEventHandler("timeHud", getRootElement(), timeHudF)
-
I setted + instead of -, but it doesn't work. No matter what, it will be outside your screen. Remove "- 1229" at all. Plus yeah, it should be guiGetScreenSize(), not getScreenSize()
-
You can use a lot of things there. "Didn't work" - debug, find problems, come on, we're not the ones who make everything for you. Would be easier if you posted the code with proper tabulations and full function.
-
Didn't test though. local timings = { } function giveCar ( thePlayer, commandName ) if getElementType ( thePlayer ) == "player" then local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) local x, y, z = getElementPosition(thePlayer) if isObjectInACLGroup ("user."..accName, aclGetGroup ("VIP")) then local currentTime = getTickCount() -- get current time local playerTime = timings[thePlayer] -- get saved player's time if playerTime then -- if the time had been saved for the player local diff = currentTime - playerTime -- find the difference of the time if diff < 25000 then -- if less than 25 seconds passed outputChatBox("25 seconds haven't passed yet",thePlayer) return false -- stop executing the function end end local comet = createVehicle ( 480, x, y, z+0.5 ) warpPlayerIntoVehicle ( thePlayer, comet ) timings[thePlayer] = getTickCount() -- save current player time else outputChatBox("You are not a VIP.",thePlayer,255,60,60) end end end addCommandHandler ( "pc", giveCar )
