
BinSlayer1
Members-
Posts
491 -
Joined
-
Last visited
Everything posted by BinSlayer1
-
function PlayerLogin() local x = 1949 local y = -3223 local z = 5 local name = getPlayerName(source) spawnPlayer(source, x, y, z) fadeCamera(source, true) setCameraTarget(source, source) setElementModel(source, 288) gW(8, 1) outputChatBox("Welcome to the Stanopolo " .. name, source) triggerClientEvent(source, "showMessage", source) end addEventHandler("onPlayerLogin", getRootElement(), PlayerLogin) function gW(gid, gammo) giveWeapon( source, tostring(gid), tostring(gammo) ) end addEvent("giveW", true) addEventHandler("giveW", getRootElement(), gW) GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Image = {} function giveWeapon(wID, wAmmo) triggerServerEvent("giveW", getLocalPlayer(), wID, ammo) end function showWelcomeMessage() GUIEditor_Window[1] = guiCreateWindow(208,274,343,289,"Stanopolo",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Image[1] = guiCreateStaticImage(68,40,203,40,"images/logo.png",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(13,78,316,169,"Welcome to the Stanopolo server.\n\n\nCurrent Version: [Alpha 1.0]",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(122,260,92,20,"OK",false,GUIEditor_Window[1]) addEventHandler("onClientGUIClick", GUIEditor_Button[1], btnOK_Click, false) end addEvent('showMessage', true) addEventHandler('showMessage', getRootElement(), showWelcomeMessage) function btnOK_Click() guiSetVisible(GUIEditor_Window[1], false) end Assuming by "attempt to call global 'showWelcomeMessage' (a nil value)" you meant "attempt to call global 'showMessage' (a nil value)" it happend because you tried to call a client function from serverside (and misspelled the function name too as showMessage ~= showWelcomeMessage) instead, call a client event from serverside and attach the event to the clientside function like in the above code
-
assuming you run a webserver, the resource in the server resources directory is not the same as the resource in the http webserver
-
attachelements (bomb, v) should be attachElements (bomb, v) about bad argument @ getElementVelocity it happens because el doesnt exist in the dropbomb() function , it is only a MarkerHit parameter so instead of 'el' you could do getPedOccupiedVehicle(player) and that means 'player' has to be defined (actually bindKey would return it as a parameter) so just do this: function dropbomb (player) instead of function dropbomb () edit: same thing goes for detachElements (bomb, el) --> el doesnt exist like i said
-
i didnt test it but looking at https://wiki.multitheftauto.com/wiki/DeleteResource , says it just requires a 1.1.1-9.03316 server to run, not a 1.2 one
-
getElementsByType() always returns a table of elements.. so it is possible to add elements to tables I suggest you use table.insert(table, element) http://pgl.yoyo.org/luai/i/table.insert
-
function submitKredit(player, geld, zinssatz) should be function submitKredit(geld, zinssatz) and addEvent("kreditabsenden", true) should be before addEventHandler I think. (swap the lines) edit: and in the outputChatBox, instead of getPlayerName(source) use source (no need to get the name)
-
you don't put it anywhere for now.. look this task that you want is not that easy especially since you say you're a beginner the task requires code rewrite + adding that dxDrawColorText function You basically need to read and understand the difference between GUI and DX and make the GUI rankingboard actually use DX https://wiki.multitheftauto.com/wiki/Int ... ng_the_GUI https://wiki.multitheftauto.com/wiki/DxDrawText I suggest you script easier stuff first
-
local max = math.max(52, 20, 24) --max contains 52 or if you want it from a table.. local max = math.max(unpack(example))
-
Offtopic: CapY actually helped someone instead of being helped :') Think that is worth celebrating
-
Yes, it affects every car.. Because it will always go on the ELSE removePed blah blah because boom1 is never equal to boom2 because like I said, boom2 is NIL and boom1 is "five" the fix: setElementData(car_1, "sfserver.carkey", "five")
-
attach onVehicleEnter to rElement? you sure that's defined? setElementData(car_1, "sfserver.carkey", five) in this line, five is probably a nil variable, maybe you mean "five" as a string and btw, only ONE car will have this carkey assigned, and that is the car that is created onResourceStart (Hope you knew this)
-
Did you take this note into consideration? https://wiki.multitheftauto.com/wiki/Md5 Note: returns an uppercase string, so make sure you string.upper() anything else you are checking against that has been MD5'd elsewhere.
-
Client hasn't finished downloading files and you request the client to run files when it is still downloading them. clientside even onClientResourceStart triggers when client downloads are complete and you can use this to tell the server that the client is ready to execute scripts. Either this, or the meta.xml is not correctly set up to load the client file as well
-
Why are you confusing him even more? What you're saying means using clientside code, while his 'lock' function is clearly serverside.. 'lock' is not defined as a client function so binding a key on it won't work
-
line 24 you say? function binding() for i,thePlayer in ipairs(getElementsByType('player')) do bindKey ( thePlayer, "L", "down", lock) end end addEventHandler('onResourceStart', getRootElement(), binding) now thePlayer is actually defined and what about late joiners? L is only assigned to people who are in the server when you start the resource. I suggest binding the key onPlayerJoin too, or whatever oh and 1 more thing i noticed. getPlayerOccupiedVehicle is deprecated. Use getPedOccupiedVehicle instead and post further errors and say exactly where the script fails. I mean does it say anything in the chatbox when you use the script?
-
That's a whole new level of laziness! Anyway there's no function that will give you the server's IP. Maybe some callRemote http://www.whatismyip.com/ But I dont know if it's possible or how to do it
-
So work around it.. if luac doesnt support utf8 then change it to ansi and when mta requires you an utf8 file then change it to utf8.. easiest way I know to change encoding is by using Notepad ++ and yes you can use /upgrade on a compiled script (you should run the latest MTA build when you do this though)
-
local HalteNr2 function cMarker(hitElement) if getElementType(hitElement) ~= "vehicle" then return end local thePlayer = getVehicleController(hitElement) local money = vioGetElementData(thePlayer, "money") vioSetElementData ( thePlayer, "money", tonumber(money)+50 ) givePlayerMoney(thePlayer, 50) destroyElement(HalteNr1B) destroyElement(HalteNr1) triggerClientEvent ( thePlayer, "Schrott", getRootElement() ) triggerClientEvent ( thePlayer, "N", getRootElement() ) HalteNr2 = createMarker ( -1923, -1785, 32, "checkpoint", 10, 125, 0, 0, 255, thePlayer ) HalteNr2B = createBlip ( -1923, -1785, 32, 0, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) addEventHandler("onMarkerHit", HalteNr2, dMarker) end PS: I took the code from the first post and edited it. I don't know if there were any previous edits, check that out yourself
-
because they all go over the marker? if you want to only make it work for the driver , check that thePlayer is vehicle controller with getVehicleController() https://wiki.multitheftauto.com/wiki/Get ... Controller
-
local passengers = getVehicleOccupants(source) givePlayerMoney(passengers[1], 100) for i = 2, #passengers do takePlayerMoney ( passengers[i], 100 ) end
-
300-line script . Really? Post the error in /debugscript 3 Nobody is going to read through all those lines to find a potential error otherwise.
-
addEventHandler('onPlayerLogout', getRootElement(), function() redirectPlayer(source, "69.245.157.67", "22003", "confidential") end ) hard script is hard
-
function damageCheck(attacker, weapon) local playeraccount = getPlayerAccount ( attacker ) if ( playeraccount ) and not isGuestAccount(playeraccount) then if getAccountData ( playeraccount, "carshow" ) then if(weapon == 5)then setElementPosition(source,1891.14,-1881.70,13.47) else end end end end local dmg = false function toggleDMG (thePlayer) if (dmg == false) then addEventHandler( "onPlayerDamage", root, damageCheck ) dmg = true else dmg = false removeEventHandler( "onPlayerDamage", root, damageCheck ) end end bindKey ( element, "F1", "down", toggleDMG ) He omitted to make dmg actually change. But you could have easily fixed this yourself, although I guess it's easier to say "pls help"
-
edit 'joinquit' resource @ onClientPlayerJoin @ outputChatBox
-
But seriously, how can you guiSetText something you didn't define? this: guiSetText ( playerSrLabel, "Your serial: " ..tostring(srs).. " " ,true,tab1) becomes: guiSetText ( playerSrLabel, "Your serial: " .."nil".. " " ,true,tab1) instead of: guiSetText ( playerSrLabel, "Your serial: " .."1hdfjsfdsfdsfdsfds".. " " ,true,tab1) because: local srs = getElementData ( getLocalPlayer(), "srs") --is defined after the text is set. It's probably the 3rd time I'm saying this and get ignored lol