Jump to content

Citizen

Moderators
  • Posts

    1,803
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by Citizen

  1. Please make a new topic when you have a new problem as it has nothing to do with a MySQL problem anymore. I'll answer anyway: You are using pixels to define the position and the size of your gui components so an absolute position and size but you are explicitly saying that they are relative instead by setting true for the relative argument. So if (for example) you set 300 for the left argument and you say it's a relative position then the gui component will be placed on the right for about 300 times the width of the player's screen resolution. Imagine if the player has a 1920x1080 screen resolution, if we keep our example, then the gui component will be placed at 1920*300 = 576000 pixels on the right so it's totally out of the screen as you can guess Fixed code: mainTeleportWindow = guiCreateWindow(left, top, windowWidth, windowHeight, "Admin Teleporter © Almighty", false) closeTeleportWindowBtn = guiCreateButton(left, top, windowWidth, windowHeight, "Close", false, mainTeleportWindow) Note that you don't want to use the same values for the button as its final position will be calculated from within its parent which is your window and not from within the player's total screen like your window which has no parent.
  2. I just installed it and it actually works just fine ! Just that I had to edit some acl myself as it failed to do so. But in the end everything is ok. Also, note that the functions list is outdated but can be updated by anyone as they are stored in a simple .db file you can open/edit with sqlitebrowser for example.
  3. We already solved that part of the topic MIKI785. You are kinda late ... @StefanAlmighty: You asked to help you to find your "SDK user and pass" but there is no such things in MTA. So try to investigate where is this error coming from. Maybe from a resource or a plugin idk. By the way where did you see this this ? in the server console ? in the chatbox ? somewhere else ?
  4. So KariiiM was right but no one here could tell for sure that you wanted a crosshair instead of the corona. Can you show us the entire function so we know where we have to work in ?
  5. So you want to put a 2D image to replace a 3D object in a 3D world ? Can you show us the image you want to put ?
  6. Where you still in 1024x768 resolution when you built that part of the panel ? Because a dx interface built in 1024x768 have to look the same when calculating the relative positions and sizes in that same resolution (like the rest of the panel).
  7. In the screenshot, the guy is using a corona ...
  8. What is the SDK ? Give us more informations about that.
  9. Make sure that the table characters exists in your database and that there are datas in it. Your script is probably calling at some point getCharacterNameFromID(x) where x is the id of the character in the table but if x is for example 4 and that there are only 1, 2 and 3 in the table, then it will throw the same error.
  10. You have to add the resource into the Admin group in your acl.xml (he surely got replaced when you did your migration so that resource is not in that group anymore). Only add resources you trust in that group and shutdown the server before manually editing acl.xml.
  11. Sounds like the MTA-MySQL module is missing/got deleted by your migration. Try to reinstall it: https://wiki.multitheftauto.com/wiki/Modules/MTA-MySQL EDIT: or there is no <module src="mta_mysql.dll" /> anymore in your mtaserver.conf.
  12. Can you provide some code where the errors occurs ? For example the doors\server_doors.lua:217 (but do not show only that line, if you can paste the whole function, it will be better).
  13. I don't know how it could work on 1.4 because the function name is mysql_ping not MySQL_ping. I'm not really sure but it can be produced by the first error. Fix the first one and see if it's still there.
  14. If a script failed to load, then it means that the script contains errors. Can we have a more complete server log please ?
  15. You were pretty close actually ! "onPlayerJoin" is a server event only, he has a "clone" in the client side called: "onClientPlayerJoin" but it's still not the right event to use in your case as it is triggered before the player downloads the client scripts. So as Tete omar said, you have to use "onClientResourceStart" which will be triggered each time a resource is started. So to make sure our showimg() function (which is the handler of our event) will be called only for the current resource, we have to restrict the scope of that handler to the root of the current resource by replacing getRootElement() by getResourceRootElement( getThisResource() ). And finally the last thing you wanted to do is to destroy/delete the image after 9 seconds. Client: local screenWidth,screenHeight = guiGetScreenSize() function showimg() local myImage = guiCreateStaticImage ( 0, 0, screenWidth , screenHeight, "1.jpg", true ) setTimer ( guiStaticImageLoadImage, 3000, 1, myImage, "2.jpg" ) setTimer ( guiStaticImageLoadImage, 6000, 1, myImage, "3.jpg" ) -- You wanted to destroy the image after 9 secs: setTimer ( destroyElement, 9000, 1, myImage ) end -- You wanted it when this resource start (and it will start when the player connected to the server and finished to download the client scripts): addEventHandler ( "onClientResourceStart", getResourceRootElement( getThisResource() ), showimg)
  16. L'erreur est effectivement toute simple et part d'une incompréhension sur comment les arguments sont passées à une fonction. Le wiki de onClientVehicleDamage nous indique les arguments qui seront passée à la fonction attaché à cet event: Donc si tu déclare ta fonction comme ceci: addEventHandler("onClientVehicleDamage", getRootElement(), function (loss) -- blaba end ) loss va donc contenir theAttacker qui est "un élément (joueur/véhicule) s'il y a effectivement un attaquant". Ce n'est pas parce que tu as mis le même nom que le 3ème argument que tu vas la récupérer dès le 1er argument de ta fonction. Le Lua ne fait pas attention aux noms que tu donnes à tes arguments, lui il donne dans le même ordre ce que l'event lui dit de donner. Donc pour récupérer la bonne valeur dans loss il faut faire comme ceci: addEventHandler("onClientVehicleDamage", getRootElement(), function (attacker, weapon, loss) -- blaba end ) Et si t'es sûr de ne pas avoir besoin des 2 première valeur, tu peux faire comme ceci: addEventHandler("onClientVehicleDamage", getRootElement(), function (_, _, loss) -- blaba end ) C'est une minuscule optimisation de mémoire qui n'est pas obligatoire et même très peu utilisée. Pour résumer, si tu veux récupérer la valeur du 3ème argument d'un event, tu dois aussi récupérer ceux qui sont avant en respectant donc l'ordre et la position. Cordialement, Citizen
  17. Oula oui en effet, y a bien plus simple, il suffit de faire 1 fonction qui va juste se charger de faire les dxDraw et qui va être appelé en boucle via l'event "onClientRender" et 2 autres fonctions qui vont juste servir à ajouter ou retirer l'event: function renderingVie() -- j'imagine que tu get la vie du joueur au-dessus dxDrawText( health.." %", x/0.628, y/9.2, x/4, y/30, tocolor( 255,255,255, 255 ), 1, "default-bold-small", "center") end function afficherVie() addEventHandler("onClientRender", root, renderingVie) end function cacherVie() removeEventHandler("onClientRender", root, renderingVie) end Et tu exportes afficherVie et cacherVie.
  18. Firstly there is no problem to set an element data from the client-side. Secondly, when you set an element data on one side (for example server side), then it's automatically available on the other side by default (for example client-side). So there is no need to send it again using a trigger.
  19. Oui tu as raison, mieux vaut supprimer ces warnings. Et bah malgré mon expérience, je n'avais jamais vu/entendu parlé de cette erreur, première fois que je la vois Mais j'ai bien compris que c'est lorsqu'on essaye de faire le même addEventHandler sur le même event avec la même fonction. Si les 2 fonctions sont au même endroit, tu peux te mettre une variable que tu passes à true dans la fonction qui fait le addEventHandler et à false dans la fonction qui fait le removeEventHandler. Sinon avec la fonction getEventHandlers il est possible de faire une fonction pour savoir s'il une fonction est déjà le handler d'un event via une source donnée. Et par chance, cette fonction à été faite dans l'exemple:
  20. Stolen from SAEG server ? If yes, how can guys like you dare come here to ask help for a script you stole somewhere ? ._.
  21. You didn't understand how server and client sided scripts works and how they should send datas between eachothers. You probably didn't read the wiki in which everything is explained: https://wiki.multitheftauto.com/wiki/Sc ... de_scripts But basically, the server scripts are loaded and executed on the server's computer whereas client scripts are dowloaded from the server's computer when the player joins, loaded and then executed on the player's computer So as they are not running on the same computer, if you create a variable on the server side, this variable won't exist on the client side (and same thing the other way). /?\ But how to send datas from one side to another then ??? /?\ - You need to send the data from one side and store that data on the other side. This is where triggerServerEventand triggerClientEventcome in ! These two functions can be used to send data(s) from the client side to the server side and from the server side to the client side respectively. Here is how you should use it in your case: CLIENT: function createGuiStuff() -- gui grid list blablabla GUIEditor.label[1] = guiCreateLabel(13, 2, 521, 15, serverName, false, GUIEditor.gridlist[1]) -- Empty for now, it will be updated by our triggerXEvents -- rest of the gui blablabla -- and do this at the end: triggerServerEvent("getServerInfo", localPlayer) -- Ask the server to send data(s) about the server to us end addEventHandler("onClientResourceStart", resourceRoot, createGuiStuff) addEvent("getServerInfoCallback", true) -- We create an event that the server will use to send the datas to us function getServerInfoCallback( servName ) -- servName will contains what the server send to us guiSetText(GUIEditor.label[1], serverName) -- updating the variable serverName we created at the top end addEventHandler("getServerInfoCallback", root, getServerInfoCallback) SERVER: addEvent( "getServerInfo", true ) function getServerInfo() local playerAsking = source -- source is a predefined variable only when the function is called by an event local serverName = getServerName() triggerClientEvent(playerAsking, "getServerInfoCallback", playerAsking, serverName) -- The above function send serverName (4th arg) only for the playerAsking(1st arg) -- using the "getServerInfoCallback" event name (2nd arg) -- and setting playerAsking as the source of the event (3rd arg) end addEventHandler("getServerInfo", root, getServerInfo)
  22. Myeah, but it won't be merged untill I fix the case when a team is destroyed/deleted. In the mean time you can use my Lua implementation of the onPlayerTeamChange I made in reply of another thread: ------- Logic for the onPlayerTeamChange event ------- addEvent("onPlayerTeamChange", true) local _playersTeamCache = {} function onPlayerTeamChangeWatcher() -- DO NOT MODIFY for i, player in ipairs(getElementsByType("player")) do local pTeam = getPlayerTeam(player) local oldTeam = _playersTeamCache[player] or false if pTeam and pTeam ~= oldTeam then -- If he changed team triggerEvent("onPlayerTeamChange", player, oldTeam, pTeam) _playersTeamCache[player] = pTeam end end end setTimer(onPlayerTeamChangeWatcher, 600, 0) --[[ you can change the "sensibility" of the team change detection: the lower the timer is, the faster the event will be triggered]] addEventHandler("onPlayerQuit", root, function () _playersTeamCache[source] = nil end) Of course I had to use an infinite timer for that. And here is the how you can use it to solve your problem: function addBlipToPlayer(player) -- will create an attached blip for a player local teamColorR, teamColorG, teamColorB = 255, 255, 255 -- default will be white local team = getPlayerTeam(player) if team then teamColorR, teamColorG, teamColorB = getTeamColor(team) end local blip = createBlipAttachedTo(player, 0, 2, teamColorR, teamColorG, teamColorB) setElementData(player, "teamBlip", blip) -- store the blip in the player element under the key "teamBlip" end function addBlipToPlayersOnStart() -- will create an attached blip for everyone for k, player in ipairs( getElementsByType("player") ) do addBlipToPlayer(player) end end addEventHandler("onResourceStart", root, addBlipToPlayersOnStart) function addBlipToPlayerOnJoin() -- will create an attached blip for anyone who joins the server addBlipToPlayer(source) end addEventHandler("onPlayerJoin", root, addBlipToPlayerOnJoin) function updatePlayerBlipColor(prevTeam, newTeam) -- will update the player's blip color whenever he changes team (includes: Join, Leave or Switching) -- defining the RGBA color the blip will take local teamColorR, teamColorG, teamColorB = 255, 255, 255 -- default will be white local blipAlpha = 255 if newTeam then teamColorR, teamColorG, teamColorB = getTeamColor(newTeam) end -- getting back the attached blip to that player and set the new color local blip = getElementData(source, "teamBlip") -- getting the blip back from the player element using the key if blip then setBlipColor(blip, teamColorR, teamColorG, teamColorB, blipAlpha) end end addEventHandler("onPlayerTeamChange", root, updatePlayerBlipColor) I didn't test it but I have a good feeling about this code By the way if you want to set a random color for the players who are not part of a team, then you have to check that it's not a color already used by a team or too close of another team color which will be kinda painfull to code. So I would stick with a predefined default color (I used white but you can change it of course). Best regards, Citizen
  23. Maybe the new modified resource now contains errors that prevents it to start, or maybe you should delay the start of the modified resource to let the onResourcePreStart and the cancelEvent finish what they are supposed to do. I would go for a setTimer of 500ms or 1sec to call the startResource (don't forget to send the resource as an argument with the setTimer).
×
×
  • Create New...