Jump to content

Citizen

Moderators
  • Posts

    1,803
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by Citizen

  1. No problem (If you want to avoid wrong answers from others, just post in the French sub-forum, I'm always available there )
  2. What is debug monitor, can you show us a screenshot about what you are talking about ? He thinks what is DayZ the Debug Monitor my post there to be only Niako edit and go to .. In english please ?
  3. Citizen

    Picker

    No you don't let's read again together: Here you said that it was taking your money when you press the CCar button (which is not true).and now you just said this: So you first said that your money was taken and then you say that your money is still the same .... And I'll repeat again, it's working for me so here is the problem (I knew it was a coming from your meta.xml): Use " instead of ': (and don't close the tag twice: type="client"/> cache="false"/>) <script src="shop.lua" type="client"/> <script src="server.lua" type="server" />
  4. So yeah to keep everything clear: You had to give an element that has player elements as children of that element and not a table of player elements. So just give the team element. Here is a useless but working example: local customPlayerRoot = createElement("lol") for k, player in ipairs(getElementsByType("player")) do setElementParent(player, customPlayerRoot) end --output to all players outputChatBox("outputChatBox using customPlayerRoot", customPlayerRoot) Ofc it will works with triggerClientEvent too.
  5. That's a nice try (edit, ok it's coming from the wiki ^^), but to be sure the script is executed, put an outputChatBox like this: function handlingChange () setModelHandling(560, "mass", 1050.0) setModelHandling(560, "turnMass", 3500.0) setModelHandling(560, "dragCoeff", 1.3) setModelHandling(560, "centerOfMass", { 0.0, 0.3, -0.15 } ) setModelHandling(560, "percentSubmerged", 75) setModelHandling(560, "tractionMultiplier", 0.65) setModelHandling(560, "tractionLoss", 0.85) setModelHandling(560, "tractionBias", 0.5) setModelHandling(560, "numberOfGears", 5) setModelHandling(560, "maxVelocity", 450.0) setModelHandling(560, "engineAcceleration", 40.0) setModelHandling(560, "engineInertia", 5.0) setModelHandling(560, "driveType", "rwd") setModelHandling(560, "engineType", "petrol") setModelHandling(560, "brakeDeceleration", 8.0) setModelHandling(560, "brakeBias", 0.5) setModelHandling(560, "ABS", false) setModelHandling(560, "steeringLock", 40.0) setModelHandling(560, "suspensionForceLevel", 1.0) setModelHandling(560, "suspensionDamping", 0.20) setModelHandling(560, "suspensionHighSpeedDamping", 0.0) setModelHandling(560, "suspensionUpperLimit", 0.28) setModelHandling(560, "suspensionLowerLimit", -0.10) setModelHandling(560, "suspensionFrontRearBias", 0.5) setModelHandling(560, "suspensionAntiDiveMultiplier", 0.3) setModelHandling(560, "seatOffsetDistance", 0.25) setModelHandling(560, "collisionDamageMultiplier", 0.60) setModelHandling(560, "monetary", 35000) setModelHandling(560, "modelFlags", 0x40002804) setModelHandling(560, "handlingFlags", 0x4000001) setModelHandling(560, "headLight", 1) setModelHandling(560, "tailLight", 1) setModelHandling(560, "animGroup", 1) outputChatBox("Handling changed successfully !") end addEventHandler("onResourceStart", resourceRoot, handlingChange) Try again an check if this message appears in your chatbox. If not, then you forgot to add this script file into your meta.xml (and should be of type server)
  6. What is debug monitor, can you show us a screenshot about what you are talking about ?
  7. Citizen

    Picker

    WRONG ! When you click the CCar button, it opens the color picker immediatly without taking money. It will take your money only when you selected a color. So here is a simple question: Why are you giving false informations ? And another one: Do you really want me to help you ? I just tried the code on my local server, and it's perfectly working ... Please show me your meta.xml and tell me the 2 files name (ex: XXX.lua and YYY.lua) in which you put the two part of this script. EDIT: I didn't test the quit and login part of this script but there is no reason it won't work.
  8. Citizen

    Picker

    And on what are you clicking on ? the CCar button or the color picker ? You are not really helping me atm. Please tell me the steps you do and which one fails.
  9. Citizen

    Picker

    I need more informations (errors on server and client side). just saying nothing happened doesn't help at all ... EDIT: Try this client instead: local CCar = guiCreateButton(206, 130, 127, 56, "Color", false) addEventHandler( "onClientGUIClick", CCar, function() exports.cpicker:openPicker ( localPlayer, "#0000FF", "Car Color color picker" ) end) addEvent ( "onColorPickerOK", true ) addEventHandler ( "onColorPickerOK", root, function ( element, hex, r, g, b ) if ( element == localPlayer ) then local r, g, b = tonumber ( r ), tonumber ( g ), tonumber ( b ) triggerServerEvent("onBuy", localPlayer, r, g, b) end end)
  10. That won't help in any way ... He wants to fake the number of players in a server to show the total of players in his other servers. Using an external website will not help at all. I don't think so... He wants to show it in his Lobby GUI. callRemote will be enough for that. Lol you are right, I read his post again, and I quickly (too quick) read what he wanted to achieve because I had the same idea a long time ago but I wanted to fake the number of players in the server list. So yeah he just wants to display the number in his gui.
  11. can you give me a simple exmaple about that ? If I do a simple example, your script will be done. I gave you a lot of informations to let you do it. So try by yourself and come back with some code.
  12. Citizen

    Picker

    A lot of little errors and missing stuff: server: function Buy(r, g, b) if getPlayerMoney(source) >= 100 then takePlayerMoney(source, 100) local vehicle = getPedOccupiedVehicle(source) setVehicleColor(vehicle, r, g, b) setElementData(source,"r", r) setElementData(source,"g", g) setElementData(source,"b", b) else outputChatBox ("You Don't have $100", source, 255, 0, 0) end end addEvent("onBuy",true) addEventHandler("onBuy", root, Buy) function Quit() local account = getPlayerAccount( source ) if account and not isGuestAccount(account) then local r = getElementData(source,"r") or 0 local g = getElementData(source,"g") or 0 local b = getElementData(source,"b") or 0 setAccountData(account, "r", r) setAccountData(account, "g", g) setAccountData(account, "b", b) end end addEventHandler("onPlayerQuit", root, Quit) addEventHandler( "onPlayerLogin", root, function(_, acc) local r = getAccountData(acc, "r") local g = getAccountData(acc, "g") local b = getAccountData(acc, "b") if r and g and b then local vehicle = getPedOccupiedVehicle(source) setVehicleColor ( vehicle, r, g, b ) setElementData(source,"r", r) setElementData(source,"g", g) setElementData(source,"b", b) end end) function updateVehicleColor() local account = getPlayerAccount( source ) if account and not isGuestAccount(account) then local r = getElementData(source, "r") or 0 local g = getElementData(source, "g") or 0 local b = getElementData(source, "b") or 0 local vehicle = getPedOccupiedVehicle(source) setVehicleColor(vehicle, r, g, b) end end addEventHandler ("onPlayerPickUpRacePickup", root, updateVehicleColor) addEventHandler ("onPlayerVehicleEnter", root, updateVehicleColor) client: local CCar = guiCreateButton(206, 130, 127, 56, "Color", false) addEventHandler( "onClientGUIClick", resourceRoot, function() if ( source == CCar ) then exports.cpicker:openPicker(localPlayer, "#0000FF", "Car Color color picker") end end ) addEvent ("onColorPickerOK", true ) addEventHandler ("onColorPickerOK", root, function ( element, hex, r, g, b ) if ( element == localPlayer ) then local r, g, b = tonumber ( r ), tonumber ( g ), tonumber ( b ) triggerServerEvent("onBuy", localPlayer, r, g, b) end end )
  13. That won't help in any way ... He wants to fake the number of players in a server to show the total of players in his other servers. Using an external website will not help at all.
  14. 1.1- Nope it's not possible using built-in functions. But you can by modifying the server source code and then compile it to then use that new mta_server.exe. You can modify how the server will reply to the informations query in ACE.cpp Check lines from line 262 to 265: https://code.google.com/p/mtasa-blue/so ... SE.cpp#261 1.2 - It's possible to query these informations by using callRemote 2 - Just set a password on the other servers and add the password when redirecting from the lobby server using redirectPlayer
  15. You can use these functions: guiCreateStaticImage(to show your logo) getElementPosition (to get the current position of your logo) interpolateBetween(to calculate the next position of the gui element for the moving animation) setElementPosition(to set the new position calculated with interpolate between) addEventHandler (to execute a function when an event is triggered) setTimer(of 50 ms to update the position of your logo) (@Others: I know it's better to use interpolateBetween with onClientRender but I think it's too complicated for now) and this event: onPlayerJoin (to know when a player joins. So we will start the animation here)
  16. Yeah, you have to create a .lua file that will be loaded and executed on the server side and in this .lua script, you have to use a couple of setModelHandling This example modifies the max speed to the max allowed in GTA SA: setModelHandling(411, "maxVelocity", 200000)
  17. Almost, you have to use localPlayer instead of root to set the element data for the player. And yeah you will be able to use it on both sides. That being said, you can also set the element data for the player on the server side instead of triggering a client side function which will set the element data.
  18. Citizen

    [SOLVED]

    Actually, this script is working, but I forgot we have a sort of a pointer to a timer so even if we kill that timer, the timer still has a value wich is not null or false. I fixed that in this new version. Btw it's now killing the checker timer too because it's not needed anymore when the player has moved: local timeBeforeSuicide = 5000 -- 5 seconds local suicideMoveCheckerTimer = 1000 -- 1 second function commitSuicide(thePlayer) local px, py, pz = getElementPosition(thePlayer) --get the current position local originPos = {x=px, y=py, z=pz} --store that pos in a table setElementData(thePlayer, "originPos", originPos) --save it as an element data local suicideTimer = setTimer(killPed, timeBeforeSuicide, 1, thePlayer, thePlayer) setElementData(thePlayer, "suicideTimer", suicideTimer) local checkerTimer = setTimer(suicidePosChecker, suicideMoveCheckerTimer, timeBeforeSuicide/suicideMoveCheckerTimer, thePlayer) setElementData(thePlayer, "suicideCheckerTimer", checkerTimer) end addCommandHandler ( "kill", commitSuicide ) function suicidePosChecker(thePlayer) local originPos = getElementData(thePlayer, "originPos") or {x=0, y=0, z=0} local px, py, pz = getElementPosition(thePlayer) --get the new position local distance = getDistanceBetweenPoints3D(px, py, pz, originPos.x, originPos.y, originPos.z) if distance >= 2 then -- if the player moved at least 2 meters local suicideTimer = getElementData(thePlayer, "suicideTimer") --get the suicide timer local checkerTimer = getElementData(thePlayer, "suicideCheckerTimer") --get the checker timer if suicideTimer and checkerTimer then --if we got them, then killTimer(suicideTimer) --kill it to prevent the suicide killTimer(checkerTimer) --kill it to prevent checking again removeElementData(thePlayer, "suicideTimer") removeElementData(thePlayer, "suicideCheckerTimer") outputChatBox("You moved and the suicide has been canceled !", thePlayer, 0, 0, 0) end end end
  19. Citizen

    [SOLVED]

    Try this: local timeBeforeSuicide = 5000 -- 5 seconds local suicideMoveCheckerTimer = 1000 -- 1 second function commitSuicide(thePlayer) local px, py, pz = getElementPosition(thePlayer) --get the current position local originPos = {x=px, y=py, z=pz} --store that pos in a table setElementData(thePlayer, "originPos", originPos) --save it as an element data local suicideTimer = setTimer(killPed, timeBeforeSuicide, 1, thePlayer, thePlayer) setElementData(thePlayer, "suicideTimer", suicideTimer) setTimer(suicidePosChecker, 1000, timeBeforeSuicide/1000, thePlayer) end addCommandHandler ( "kill", commitSuicide ) function suicidePosChecker(thePlayer) local originPos = getElementData(thePlayer, "originPos") or {x=0, y=0, z=0} local px, py, pz = getElementPosition(thePlayer) --get the new position local distance = getDistanceBetweenPoints3D(px, py, pz, originPos.x, originPos.y, originPos.z) if distance >= 2 then -- if the player moved at least 2 meters local suicideTimer = getElementData(thePlayer, "suicideTimer") --get the timer if suicideTimer then --if we got it, then killTimer(suicideTimer) --kill it to prevent the suicide outputChatBox("You moved and the suicide has been canceled !", thePlayer, 0, 0, 0) end end end
  20. From PMs: Try with this: (check the comments to see what I added) server: local forbiddenAreas = { {0, 0, 50, 50}, {-500, -1613, 50, 50} } addEventHandler("onResourceStart", resourceRoot, function() for k, i in ipairs(forbiddenAreas) do local col = createColRectangle(i[1], i[2], i[3], i[4]) addEventHandler("onColShapeHit", root, function ( hitElement ) if getElementType(hitElement) ~= "player" then return end setElementData(hitElement, "isInForbiddenArea", true) if getElementData(hitElement, "isF1MenuOpened") then -- added triggerClientEvent("forcePressF1", hitElement, randomSecret) -- added end -- added end) addEventHandler("onColShapeLeave" root, function( leaveElement ) if getElementType(leaveElement) ~= "player" then return end setElementData(leaveElement, "isInForbiddenArea", false) end) end end) function bindF1( param ) if param then for k, i in ipairs(getElementsByType("player")) do bindKey(i, "f1", "down", openF1) end else bindKey(source, "f1", "down", openF1) end end addEventHandler("onResourceStart", resourceRoot, bindF1) addEventHandler("onPlayerJoin", root, bindF1) local randomSecret = "secret_" .. math.random(10000) function openF1( player, cmd, preventLoop ) setElementData(hitElement, "isF1MenuOpened", true) -- added if preventLoop ~= randomSecret and getElementData(player, "isInForbiddenArea") then triggerClientEvent("forcePressF1", player, randomSecret) end end addCommandHandler("fr", openF1) client: addEvent("forcePressF1", true) addEventHandler("forcePressF1", root, function ( secret ) executeCommandHandler("fr", secret) setElementData(localPlayer, "isF1MenuOpened", false) -- added end) If this is not working properly, then I'll just do the whole thing using another way. I didn't want to make modifications into the freeroam resource itself to keep this modification seperated. So I'll just export 2 freeroam functions and use them from your resource.
  21. Ok alors le mec publie sa ressource mais ne test pas juste avant ... Donc en remontant les définitions des variables: On a l'utilisation de defdd dans le if ok, on remonte et on voit qu'elle est censé être définie ligne 14 en utilisant un tableau envoyé via l'event onClientLoadSettings, qui est "triggered" du côté serveur ligne 82. Ce trigger ligne 82 est dans une fonction qui est appelé via l'event onLoadSettings qui n'est "triggered" nulle part. (Il devait sûrement le "triggered" via une autre de ses ressources et il n'a donc pas vu/eu ce problème). Donc 2 solutions: - tu "trigger" l'event toi-même (dans s.lua): triggerEvent("onLoadSettings", resourceRoot) que tu peux mettre ligne 85 (rajoutes des lignes s'il faut): - tu remplaces l'event "onLoadSettings" par l'event "onResourceStart" (remplace la ligne 69 par ceci): addEventHandler ( "onResourceStart", resourceRoot, Dans les 2 cas, l'erreur devrait disparaître et ça devrait fonctionner (à condition qu'il n'y ai pas d'autre bugs).
  22. Je ne sais pas à quoi correspond la ligne 147 chez toi. mais en supposant que c'est la ligne de mon if, tente de remplacer par ça: if attachedTo and isElement( attachedTo ) then Mais je ne comprends pas comment l'erreur soit liée avec ce if vu que ça ne retourne jamais un nombre oO
  23. Oui c'est normal, parce que la ressource que tu utilises pour afficher les textes en 3D ne prend pas en compte le fait qu'il soit attaché à un élément lors du calcul de la position. J'ai téléchargé la ressource et merci à l'auteur qui n'a pas compilé ses sources (c'est plutôt rare malheureusement) et j'ai pu donc lire rapidement et comprendre le code. Il n'y a, en effet, aucune gestion pour les textes attachés (ils ne bougent pas et restent donc à l'endroit x, y, z où il a été créé. J'ai donc rapidement modifié le code et je pense que ça devrait fonctionner (je n'ai pas testé). Il te faut rajouter ce bout de code au début de la boucle for qui permet d'afficher tous les textes créés (ligne 134 du fichier c.lua de la ressource easy3dtext): local attachedTo = getElementAttachedTo( t ) --on récupére l'élément auquel il est peut être attaché if attachedTo ~= nil and isElement( attachedTo ) then --si on en a un et que c'est bien un élément alors: local atX, atY, atZ = getElementPosition( attachedTo ) --on récupère la position de cet élément local ofX, ofY, ofZ = getElementAttachedOffsets( t ) --on récupère l'ajustement du texte (par rapport à l'élément) setElementPosition( t, atX + ofX, atY + ofY, atZ + ofZ ) --on déplace le texte à la position de l'élément avec l'ajustement. end Tu devrais donc te retrouver avec quelque chose comme ceci: ... local px, py, pz = getElementPosition ( getLocalPlayer ( ) ) for i, t in ipairs ( getElementsByType ( "text" ) ) do local attachedTo = getElementAttachedTo( t ) if attachedTo ~= nil and isElement( attachedTo ) then local atX, atY, atZ = getElementPosition( attachedTo ) local ofX, ofY, ofZ = getElementAttachedOffsets( t ) setElementPosition( t, atX + ofX, atY + ofY, atZ + ofZ ) end local cx, cy, cz = getElementPosition ( t ) local dist = getDistanceBetweenPoints3D ( px, py, pz, cx, cy, cz ) ... Pense bien à te /login et te mettre en /debugscript 3 (marchera que si t'es admin dans l'acl) pour voir les éventuelles erreurs de scripts si je me suis planté quelque part.
  24. If you had read and understand what I just wrote, then you would find out by yourself... If you want to place a window of size 20% ,30% (width and height) at the top right corner for every resolutions: x: 100% - 20%/2 means the right side of the screen y: 0% means the top side of your screen width: 20% height: 30%
  25. No problem, and sorry because this script should have work since my 1st post (but wouldn't support a restart for players already in game and using F1 key). I didn't know the bug (I guess it's a non scripting behaviour) about that executeCommandHandler. Have fun coding.
×
×
  • Create New...