Jump to content

TheCapn

Members
  • Posts

    87
  • Joined

  • Last visited

Everything posted by TheCapn

  1. Hello guys, I was wondering if MTA enables us to make a complete weapon system using client and server side's function : setWeaponProperty. Is it, for instance, possible to set for the player1 a specific M4 damage (lets take 50 for instance) and for the player2 another damage for the M4 (40 for him) and so when player1 will shoot at player2 with the M4, it will damage him more than if it was player2 who has shot at player1 ? I'm not sure if I was perfectly clear. If it's not the case, let me know it, but thank you for your answers. Regards, TheCapn
  2. Weel, seems to work by now ! Strange, indeed. Anyway : thanks
  3. Just added, sorry, I miss clicked and submit instead of preview
  4. Hello guys, I'm making a script that checks if the account is registered, and if it's not, it triggers a client-side function that draw a window with a text and a button that will kick the player as soon as he click on the button. However, when I try to trigger the client-side event on the server side, I have this error : ERROR: Server triggered clientside event onUnregAccount, but event is not added clientside Since I don't really know where the issue comes from, I'll give you the two complete code of my files : client and server side Server-side local handler = exports.exports:mysqlConnectHandler() function isAccountRegistered() local query = dbQuery( handler, "SELECT * FROM `users` WHERE `username` = ?", getPlayerName( source ) ) local result, num_affected_rows, last_insert_id = dbPoll( query, -1 ) if num_affected_rows > 0 then outputChatBox( "Compte existant.", source ) local spawnedPlayer = spawnPlayer( source, 0, 0, 0, 0, 66, 0, 0) if spawnedPlayer then fadeCamera( source, true ) setCameraTarget( source, source ) outputChatBox("Votre personnage a été initialisé avec succès. Bon jeu.", source ) end else triggerClientEvent(source, "onUnregAccount", getRootElement()) end end addEventHandler( "onPlayerJoin", getRootElement(), isAccountRegistered ) function unregHandler() kickPlayer( source ) end addEvent( "submitUnreg", true ) addEventHandler( "submitUnreg", root, unregHandler) Client-side -- La fenêtre suivante s'affiche dans le cas où le compte n'est pas enregistré dans la base de données function createUnregWindow() wdwUnreg = guiCreateWindow(0.39, 0.37, 0.22, 0.20, "COMPTE INEXISTANT", true) guiWindowSetSizable(wdwUnreg, false) msg = guiCreateLabel(0.07, 0.15, 0.85, 0.37, "Votre compte n'est pas enregistré dans notre\nbase de données. \nIl est nécessaire de s'inscrire sur notre site \npour pouvoir rejoindre le serveur.", true, wdwUnreg) guiSetFont(msg, "default-bold-small") website = guiCreateLabel(0.30, 0.56, 0.37, 0.12, "http://siteweb.com", true, wdwUnreg) validate = guiCreateButton(0.06, 0.77, 0.86, 0.17, "Valider", true, wdwUnreg) guiSetFont(validate, "default-bold-small") guiSetVisible(wdwUnreg, false) end addEvent("onUnregAccount", true) function unregAccount() createUnregWindow() if wdwUnreg ~= nil then guiSetVisible(wdwUnreg, true) else outputChatBox("An unexpected error has occurred and the log in GUI has not been created.") end showCursor(true) addEventHandler("onClientGUIClick", validate, clientSubmitUnreg, false) end addEventHandler("onUnregAccount", getResourceRootElement(getThisResource()), unregAccount ) function clientSubmitUnreg(button,state) if button == "left" and state == "up" then guiSetInputEnabled(false) guiSetVisible(wdwUnreg, false) showCursor(false) triggerServerEvent("submitUnreg", getRootElement()) end end Regards, TheCapn
  5. Well, I know there is this animation on San Andraes Multiplayer, so I guess it might be here to !
  6. Hello guys, I was wondering what was the animation to "cuff" the player and so he has his hands in his back, linked ? Regards,
  7. I'm using setElementData and getElementData that I've synchronized. Because I'm using a local timer and I would like to save the remaining time of the timer when the player quits.
  8. Salut, Actuellement, il y a FoxRP qui est en ligne (côté français) Sinon, il y a MTAROLEPLAY qui est le plus connu des serveurs anglophones. Personnellement, je suis en train de lancer mon serveur, si tu veux faire un tour : http://weroleplay.fr Bon jeu à toi
  9. That's actually what I'm using on client side On server side, I use : onPlayerQuit
  10. Hello guys, I'm using a client side .lua file and I would like to trigger an event when the player disconnect. In fact, when the player disconnect I would like to save the data that are in the client side script file, and at the same time saving the server side data. But I realized that the server-side was a priority for the server and so the client side datas are not saved. Wich event could I use on client-side to handle this ? Regards,
  11. Hello guys, I would like to play a sound 3D at .mp3 format, but I don't know how-to configure my meta.xml file as It's not noticed in the wiki. If I put the .mp3 file in the same folder than the .lua file who call it, how shoud I handle it ? Regards,
  12. Hello guys, I would like to trigger an client event only for on player, but actually when I trigger it, it triggers for every one. Here's my code function loginHandler(username, password) ... triggerClientEvent(getRootElement(), "onBan", getRootElement(), banauthor, banreason, bantime) ... end Username and password are only strings. Regards,
  13. Thanks a lot ! It's working now
  14. Hello guys, I've taken this following script from the wiki and I've changed it for my purpose. It seems to work correctly in fact, but : For exemple, when I say on the chat box : Hello guys how are you ... I have this -> Franklin_Walker dit : Hello guys, how are you 0 I don't know where this "0" comes from, but maybe you could explain me Here's my code : function sayHandler(...) message = table.concat({...}, " ") local sender = getPlayerName(source) local posX, posY, posZ = getElementPosition(source) local saySphere = createColSphere( posX, posY, posZ, sayRadius ) local nearbyPlayers = getElementsWithinColShape( saySphere, "player" ) destroyElement( saySphere ) for index, nearbyPlayer in ipairs( nearbyPlayers ) do outputChatBox(""..sender.." dit : "..message.."", nearbyPlayer, 255, 255, 255, true) end end addEventHandler( "onPlayerChat", getRootElement(), sayHandler ) function basicChatMessage() cancelEvent() end addEventHandler( "onPlayerChat", getRootElement(), basicChatMessage ) Regards,
  15. TheCapn

    Jail system

    Ok but how to link it to a specific player, actually ?
  16. TheCapn

    Jail system

    Hello guys, I was trying to make a jail system, but I was wondering something : how can I link a timer to a specific player ? Because otherwise I don't know how to proceed for a jail system.
  17. Salut, J'ai créé un timer dans ma ressource Admin, et j'aimerai pouvoir récupérer les éléments de ce timer dans ma ressource Player. Je suis passé par un setElementData et un getElementData mais visiblement ça ne fonctionne pas Dans ma ressource admin jailTime = 10000 local jailTimer = setTimer(unjail, jailTime, 1) setElementData(thePlayer, "player.ajail", jailTimer) Dans ma ressource player local jailTimer = getElementData(thePlayer, "player.ajail") remaining, executesRemaining, totalExecutes = getTimerDetails(jailTimer) print(remaining) Mais j'ai l'impression qu'il est impossible de caler un timer dans un elementData Possible de me proposer une autre façon de faire ?
  18. Salut, Depuis que je commence à coder sur MTA, les setElementData et getElementData me sont apparus comme l'incontournable pour gérer des données. Les tables m'ont toujours emmerdées sur LUA, à tort peut être. Mais est-ce que les ElementData bouffent beaucoup de ressources ?
  19. Thanks, But now how can I get all the values of my table ?
  20. Thanks a lot ! I'm going to try this as soon as possible
  21. Hello guys, At the player's login, I would like to know if his username is registred in the database. If it's registred, I would like to gather all the information of the account and put it on several variables. However, I quite impressed by the mySQL in LUA so I have difficulties to make request. Could you give me an exemple of the system I've just described ? Regards,
  22. It can be useful If we want to send a special message to each kind of player, I guess
×
×
  • Create New...