Jump to content

Lpsd

Administrators
  • Posts

    319
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Lpsd

  1. Lpsd

    i have a problem

    Your event handling is all wrong. Do not pass the local player as an argument to the event like this: triggerServerEvent("onLoginWith",localPlayer,user,pass) Things wrong here: - you're making the source element the local player, that will not work - you're trying to pass the local player as an argument You should use the predefined variable `client` on the serverside. `client` contains the player that called the event. This is for security purposes. You should also set the source argument to resourceRoot, instead of localPlayer So you'd have: triggerServerEvent("onLoginWith", resourceRoot, pass) addEventHandler("onLoginWith", root, function(pass) local user = client ... end) Now in the rest of your code where you've tried to use 'source' to get the player, replace it with client.
  2. This can be done with some basic math. Let's say we're positioning the notifications from 0,0 on the client's screen (top left) --Notification values local notificationBaseX, notificationBaseY = 0, 0 local notificationWidth, notificationHeight = 200, 60 local notificationMargin = 7 local notifications = {} --Our table where the notifications are stored. function createNotification(text) --Example function to create a notification table.insert(notifications, text) end function renderNotifications() --Draw the notifications for i, notificationText in ipairs(notifications) do local notificationX, notificationY = notificationBaseX + notificationMargin, notificationBaseY + (notificationHeight + notificationMargin) * (i - 1) --Add the notification height & margin, then multiply that by the current notification index. We'll start indexing at 0 by removing 1 from the current index. dxDrawRectangle(notificationX, notificationY, notificationWidth, notificationHeight, tocolor(255, 0, 0)) dxDrawText(notificationText, notificationX, notificationY, notificationX + notificationWidth, notificationY + notificationHeight, tocolor(255,255,255), 1, "default-bold", "center", "center") end end addEventHandler("onClientRender", root, renderNotifications) --Create the notifications createNotification("Notification 1") createNotification("Notification 2") createNotification("Notification 3") I hope that's enough to get you started. Any questions just ask
  3. Lpsd

    Ped Atack

    Tons of things wrong with this. For a starter you're calling the onPedRender function every frame without any kind of checks to see if "thePed" exists, or if he already has the weapon which you're trying to give him - that's extremely bad practice. Also, where is this "findRotation" function? You haven't included in the code. In future please provide the full error, I highly doubt it was just "a nil value". That helps no one.
  4. Well it looks like you didn't enable OOP in the meta.xml, using <oop>true</oop>
  5. (edited answer) You are inserting the ped by doing table.insert( taxidf[player].ped, { ped } ) which makes a table inside the ped table. To retrieve the ped, you'd need to do: local ped = taxidf[player].ped[1][1]; But really, unless you need it for a specific reason, you should just change the insert line to: table.insert( taxidf[player].ped, ped )
  6. Use Google to look for other YouTube APIs. or host your own YouTube downloader/converter using youtube-dl and FFmpeg.
  7. Lpsd

    table.concat

    You don't. You need the command syntax to be different, such as: /oxquestion This is the question text|This is the answer text addCommandHandler("oxquestion",function(player, cmd, ...) local t = table.concat({ ... }, " ") local questionTable = {} local answerTable = {} local switch = false for i,v in ipairs(t) do if v == "|" then switch = true else if switch then table.insert(answerTable, v) else table.insert(questionTable, v) end end table.remove(t, i) end end) "|" is the separator for question/answer.
  8. Lpsd

    MTA not working.

    Did you try reinstalling GTASA rather than MTA? It's a problem with a GTASA file, not MTA (at least as far as I can tell from the info provided) ...GTA:SA had trouble opening the file 'TIMECYC.DAT'... Try restoring that file from the error to original, (google for ''timecyc.dat backup'' for a download) in your GTA folder. (or it may have been removed by customization/bad modding, it should be located at Program Files (x86)\Rockstar Games\GTA San Andreas\data
  9. Does that actually compress the TXD though or the images?
  10. As far as I'm aware you can't compress TXD or DFF. You should compress the images you use rather than the actual TXD. Also don't use huge dimensions for your textures if they are for something that isn't important, or something small. I don't really use many custom TXDs in my stuff but I imagine 512x512 would be the biggest you want your images to be. Again, you can't compress a DFF. File size is linked with the amount of polys used in your models, so you should work on decreasing them - this is especially true if you're downloading free models from around the web as most of them won't be optimized.
  11. https://wiki.multitheftauto.com/wiki/SetPlayerMuted
  12. Lpsd

    antiban

    I wasn't aware cancelEvent() couldn't stop the ban, however there's no need to loop through all the bans (highly inefficient), just use the banPointer parameter provided onPlayerBan edit: just checked your errors to the script I provided, it looks to me like you either tried banning a player via console or you're using a custom ban script and not utilizing the responsibleElement argument within banPlayer()/addBan() function verifyBan(banPointer, responsiblePlayer) if not isElement(responsiblePlayer) then print("responsibleElement is Console or none stated for current ban"); return false end if getElementType(responsiblePlayer) ~= "player" then return false end if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then removeBan(banPointer)--Remove the ban on admin, using banPointer addBan(getPlayerIP(responsiblePlayer), nil, getPlayerSerial(responsiblePlayer), root, "Banning other admins") --Ban the offending moderator outputChatBox (getPlayerName(responsiblePlayer).." has been banned for banning admins!", getRootElement(), 255, 0, 0) -- Output the ban. end end addEventHandler ( "onPlayerBan", getRootElement(), verifyBan )
  13. Lpsd

    antiban

    I assume you used debugscript? Can you tell me what the errors are, or what exactly it is that doesn't work?
  14. Lpsd

    antiban

    This isn't a problem you should initially be trying to solve with code. You shouldn't be giving people permissions on your server if you can't trust them. However, something like this might help. If anyone tries to ban an admin the action will be blocked and they'll get banned them-self (Serial and IP ban). function verifyBan(banPointer, responsiblePlayer) if getElementType(responsiblePlayer) ~= "player" then return false end if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then cancelEvent() --Cancel the ban on admin addBan(getPlayerIP(responsiblePlayer), nil, getPlayerSerial(responsiblePlayer), root, "Banning other admins") --Ban the offending moderator outputChatBox (getPlayerName(responsiblePlayer).." has been banned for banning admins!", getRootElement(), 255, 0, 0) -- Output the ban. end end addEventHandler ( "onPlayerBan", getRootElement(), verifyBan ) Not tested, try it out and see if it works.
  15. Lpsd

    antiban

    I don't get what you're trying to do. Players shouldn't have access to ban - why would admins be getting banned?
  16. Here's an example of a PHP script I found with a quick google search https://gist.github.com/tbreuss/74da96ff5f976ce770e6628badbd7dfc Combine this with the PHP SDK (https://development.mtasa.com/wiki/PHP_SDK) and the callRemote function (https://development.mtasa.com/wiki/CallRemote) to send the Player's IP to the php script and return a result.
  17. Lpsd

    Help me Plis

    local screenWidth, screenHeight = guiGetScreenSize() local webBrowser = createBrowser(screenWidth, screenHeight, false, false) function webBrowserRender() dxDrawImage(0, 0, screenWidth, screenHeight, webBrowser, 0, 0, 0, tocolor(255,255,255,255), true) end addEventHandler("onClientBrowserCreated", webBrowser, function() loadBrowserURL(webBrowser, "https://wiki.multitheftauto.com/wiki/Main_Page") addEventHandler("onClientRender", root, webBrowserRender) end ) Load this script and you should have all the information you need.
  18. Hey guys, look at this random chunk of code. Can you try and decipher what problem I'm having without giving you any information whatsoever? First of all it might help to tell us what exactly the problem is. What errors are you getting? Where are your database connection details?
  19. You can't return values like that, you have to create an event running the other way (server->client) Simple example --Clientside function getData(charid) triggerServerEvent("pushData", root, charid) --send charid to server end function receiveData(info) --do something with info end addEvent("onClientReceiveData", true) addEventHandler("onClientReceiveData", root, receiveData) --Serverside function processData(charid) local thePlayer = client --client is a predefined variable, contains the client who triggered the event --use charid to get your info triggerClientEvent(thePlayer, "onClientReceiveData", thePlayer, charid) --send info back (replace "charid" with whatever you want to send) end addEvent("pushData", true) addEventHandler("pushData", root, processData)
  20. Why don't you use exported functions instead? https://wiki.multitheftauto.com/wiki/Call
  21. You're only as fast as your slowest component. Everything in your PC is important, however the main things; Plenty of RAM Fast CPU Fast Disk (SSD pref) Powerful GPU If you were looking for suggestions on PCs to buy (I assume you're looking for pre-built), then you might want to include your budget.
  22. Lpsd

    About SLUA

    I assume you're talking about file extensions - people might name their script *.slua (or .clua for that matter) to easily sort files in a directory. Other than that it's no different to your normal MTA Lua. You could have clientside code in a script called "code.slua" and it'd function fine - what matters is the definitions in the meta (type="server/client") atleast i'm pretty sure of it...
  23. Lpsd

    Help

    https://wiki.multitheftauto.com/wiki/GuiSetInputEnabled or https://wiki.multitheftauto.com/wiki/GuiSetInputMode
  24. Lpsd

    GUI skin?

    https://forum.multitheftauto.com/forum/115-custom-gui-themes/
×
×
  • Create New...