-
Posts
1,803 -
Joined
-
Last visited
-
Days Won
8
Everything posted by Citizen
-
Recherche objet de cette vidéo et un speed bump
Citizen replied to Lord Falcon's topic in French / Français
Je ne pense pas que ça soit cet objet. Mais si c'est celui là, pour faire la face plate, suffit de le laisser à l'endroit comme sur le screen n°2 et juste de le dupliquer en le décalant sur le côté afin de mettre les petites faces côtes à côtes, il t'en faudra 4 ou 5 pour la faire aussi grande que sur la vidéo. Et si c'est pour SAMP, pourquoi poser des questions sur le forum de MTA ? C'est pas parce que "vous" profiter des tools de MTA qu'on doit forcément vous aider à faire votre map pour SAMP. Je suis pas méchant, c'est juste que je n'aime pas ce genre de pratique. Ça ne l'est ptêtre pas pour toi, mais pour moi c'est comme si t'allais dans un magasin Orange pour demander à des employés de t'aider à installer ta carte sim SFR dans ton téléphone. (ça ferai une bonne vidéo youtube ça d'ailleurs. Limite virale tiens. lol) Donc voilà j'espère que t'y arriveras mais les voitures du style Infernus vont à coup sûr prendre des dégâts (même avec les ralentisseurs de la vidéo). ++ -
Recherche objet de cette vidéo et un speed bump
Citizen replied to Lord Falcon's topic in French / Français
C'est normal que tu ne l'ai pas trouvé, car il s'agit en réalité d'une combinaison de 3 objets: 2 inclinés et 1 horizontal. C'est surement un muret mais alors lequel ? ça faut chercher Etant au boulot, je ne peux le chercher à ta place mais je chercherais avec "fence", "gate", "wall" dans le map editor. et en cas d'echec, faudra se taper toute la liste. En tout cas niveau longeur c'est pile-poil la largeur de la route. -
Et bah voilà, si en laissant que DayZ et le login t'as la crosse à l'épaule, c'est que t'as enlevé la ressource responsable du démarrage automatique. Suffit de savoir laquelle en les lançant manuellement jusqu'à ce la crosse ne soit plus à ton épaule. Enfin ça parait logique nan ? Et cette ressource à sûrement un nom du style "realskill" ou "realisticquelquechose".
-
En les désactivant une par une peut être ?
-
Je suis quasiment sûr que c'est ton mod MTA DayZ qui à changé exprès, mais vérifie si ce n'est pas une ressource que tu as téléchargée récemment.
-
Première chose, il faut savoir que la variable source est une variable "cachée" car elle est implicitement créée dans ta fonction par MTA. Mais cette variable n'est crée que lorsque cette fonction traite (handle) un event comme onPlayerSpawn , onMarkerHit etc. Elle n'est donc pas créée lorsque la fonction traite une commande. Mais alors comment on sait qui à taper la commande ? (Désolé si tu le prends mal) Et bien si tu avais lu l'Introduction à la programmation dont j'ai pris la peine de le traduire en français et reformuler certaine parties pour qu'elles soient plus compréhensibles, tu le saurais déjà. Le wiki détail également ce que ta fonction reçoit en paramètre lorsqu'elle est attaché à une commande via addCommandHandler donc je cite: On peut donc voir que le 1er argument d'une fonction est le joueur qu'il l'a tapé. Dans ce code là c'est donc gracz qui correspond au joueur. Mais comme ta copié collé du code d'un polonais, forcément ta pas pu deviner en lisant le code (remarque il l'utilise pour le setElementPosition, t'aurais presque pu deviner). Donc reprends plutôt ce code là: (C'est le même sauf que j'ai renommé la variable gracz en thePlayer pour que ça soit plus évident et j'ai remplacé source par thePlayer) function teleport(thePlayer, cmd) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Police" ) ) then setElementPosition(thePlayer, 1586.52112, -1607.66797, 13.38281) else outputChatBox("Vous n'êtes pas de la SAPD", thePlayer, 255,241,0) end end addCommandHandler("prison1", teleport) Et donc là ça devrait faire ce que tu veux. (Juste pour info, ça l'affichait à tout le monde car source n’existait pas donc quand tu lui donnes source en paramètre, tu lui donnes donc sa valeur qui est nil c'est à dire "inéxistant" et quand outputChatBox reçoit nil en 2ème paramètre, il prend la valeur par défaut qui est getRootElement() d'après le wiki c'est à dire "Tout ce qui existe dans le serveur". Donc même les objets et les voitures le reçoivent mais forcément, comme ça sert à rien de leurs afficher le message, il ne l'affiche qu'aux joueurs). Je t'invite à faire ce tutoriel en entier qui pose les bases comme les commandes, le fonctionnement général du serveur, les events etc: https://wiki.multitheftauto.com/wiki/FR/ ... grammation Bon codage
-
Nope, line 21, not line 20.
-
The syntax is wrong, you probably meant: SELECT * FROM tableName And it will return all rows and columns from a table with the name "tableName" But before that you probably 1st want to list all tables from the database you are connected on: SHOW TABLES And if you need to list databases: SHOW DATABASES
-
Comment the line 25 and see if it work.
-
Hehehe, I don't test my code 90% of the time because my code works at first try 9 times out of 10. So thanks for the advice but I'll just ignore it. Good luck with your problems in the future.
-
And what is className ? Come on, give us the code we need, not 1 line after the other. Your code was expecting a table and not a class name as a string. The error says it got nil instead of a table. So it means the value of className here setElementData(player, "class", className) is nil. So give us the code above that line ! + If you want to use a classe name instead of a table of class members, then use this code (based on iAbo's code): function classchat(player, command, ...) local message = table.concat({...}, " ") for i,v in ipairs(getElementsByType("player")) do if getElementData( player, "class" ) == getElementData( v, "class" ) then outputChatBox("*CLASS*" .. getPlayerName(player) .. ": " .. message , v, 255, 100, 0, true) end end end addCommandHandler("class", classchat) Note (and I repeat) the code will still not work untill you fix the className value for the setElementData
-
Oh yeah ofc. I'm a bit slow these days :facepalm: ^^
-
oh yeah, this is coming from my GM, my bad, I meant getElementByID
-
Ok so ... There were some errors that were shown. Do you know that client side errors doesn't display on the server console right ? You have to use /debugscript 3 as admin (so /login first and be sure you are in the admin acl group). Anyway, here is the fixed code: local button = {} local window = {} window[1] = guiCreateWindow(370, 277, 305, 402, "UGC ~ Vehicles Spawner", false) guiSetVisible(window[1], false) guiWindowSetSizable(window[1], false) gridlist = guiCreateGridList(9, 63, 282, 268, false, window[1]) Col1 = guiGridListAddColumn(gridlist, "Vehicles", 0.5) Col2 = guiGridListAddColumn(gridlist, "id", 0.5) button[1] = guiCreateButton(10, 350, 113, 22, "Spawn", false, window[1]) guiSetFont(button[1], "default-bold-small") guiSetProperty(button[1], "NormalTextColour", "FFAAAAAA") button[2] = guiCreateButton(178, 350, 113, 22, "Hide", false, window[1]) guiSetFont(button[2], "default-bold-small") guiSetProperty(button[2], "NormalTextColour", "FFAAAAAA") guiSetVisible(window[1], false) function onRoleMarkerHit( element ) if element ~= localPlayer then return end local markerRole = getElementData(source, "role") local playerRole = getElementData(element, "Occupation") mx, my, mz = getElementPosition(source) if markerRole == ROLES.POLICE_OFFICER and playerRole == ROLES.POLICE_OFFICER then guiSetVisible(window[1], true) showCursor(true) end end for i,v in ipairs(roleMarkers) do local marker = createMarker(v.mx, v.my, v.mz, "cylinder", 1.5, v.mr, v.mg, v.mb) setElementData(marker, "role", v.role) addEventHandler("onClientMarkerHit", marker, onRoleMarkerHit) end
-
I meant: "Can you show the code where you are setting this "class" element data ?" Because this data should be a table, and I want to see how did you make this table (how did you fill it).
-
Hmmm interesting. Did you restart the mysql server (or the whole vps) after commented this line ? If yes, then I would try to put bind-address = 127.0.0.1 to make it listening on the loopback ip. If it's still doesn't work, comment this line again and create a new user with correct permissions in phpMyAdmin and then try to connect again (with 127.0.0.1, or your vps ip). We have to figure this out ! That's so weird !
-
thanks man, this is what I needed This is dirty !!! + it will produce bugs if you are on the server side (since the exact same global will be used by every players and possibly at the exact same time for 2 of them). This is what you should do (as myonlake sugested): function test() local timer = 10 local theTimer = setTimer(function( selfTimer ) -- receive theTimer as selfTimer if (timer > 0) then timer = timer - 1 else killTimer(selfTimer) end end, 1000, 0, theTimer) --give theTimer as function parameter end
-
This is not a place to make requests for scripts. We can only help you to achieve this. addCommandHandler getPlayerFromName -- getPlayerFromId --EDIT: getElementByID getElementPosition setElementData --to store some datas "in" a player, like it's original position and a state that will let you know he is in duel. setElementPosition -- to teleport them setElementDimension -- (optional) to "teleport" them in another dimensions so no one can see/kill/be killed by them. getPedWeapon --in a loop to get all weapon the player currently has getPedTotalAmmo --in the same loop to get the ammo for that weapon takeAllWeapons --to remove all weapons for a player giveWeapon -- to give the weapons for the duel onPlayerWasted onPlayerQuit getElementData --to get the datas we stored "in" the players earlier Come back with some code if you can't get it to work.
-
local screenWidth,screenHeight = guiGetScreenSize() GUIEditor = { button = {}, window = {} } local possibiltyThings = {2,4,6,8,10,12,14,16,18,20} addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(207, 166, 224, 167, "SARG:RPG Lottery Panel", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(25, 99, 180, 31, "close", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(31, 33, 164, 34, "Buy Ticket", false, GUIEditor.window[1]) GUIEditor.button[3] = guiCreateButton(456, 683, 453, 35, "Scratch The Ticket To See If You Win!", false) guiSetVisible(GUIEditor.window[1], false) guiSetVisible(GUIEditor.button[3], false) -- scratch button addEventHandler("onClientGUIClick", GUIEditor.button[3], function() lotteryTickOpen = false lotteryTickScratchedOpen = true exports.SARGcommands:sendClientMessage("*SARG Lottery* Goodluck!", 0, 255, 0) guiSetVisible(GUIEditor.button[3], false) randomNumbers = {} for k=1, 9 do table.insert(randomNumbers, possibiltyThings[math.random(#possibiltyThings)]) end --check for 3 same values in randomNumbers: sameValueCount = {} local amountToGive = 0 for k, v in pairs(randomNumbers) do sameValueCount[v] = (sameValueCount[v] or 0) + 1 if (sameValueCount[v] == 3) then amountToGive = amountToGive + v*1000 end end if amountToGive > 0 then outputChatBox("You won: $"..amountToGive) exports.SARGcommands:giveMoney(localPlayer, amountToGive) else outputChatBox("Sorry, you lost !") end setElementData(localPlayer, "ticketsLeft", (getElementData(localPlayer,"ticketsLeft") or 0) - 1) setTimer(closeLoteryTicket, 5000, 1) end) -- close button addEventHandler ( "onClientGUIClick", GUIEditor.button[1], function() guiSetVisible(GUIEditor.window[1], false) showCursor(false) end) -- buy button addEventHandler ( "onClientGUIClick", GUIEditor.button[2], function() if(getElementData(localPlayer, "ticketsLeft"))then setElementData(localPlayer, "ticketsLeft", getElementData(localPlayer,"ticketsLeft")+1) exports.SARGcommands:sendClientMessage("*SARG Lottery* You have bought 1 ticket! Do /lotto to see if you won! ( You have a total of "..tostring(getElementData(localPlayer,"ticketsLeft")).." tickets now!)", 0, 255, 0) else setElementData(localPlayer, "ticketsLeft", 1) end end) -- marker local lottoStoreMarker = createMarker(2637.25390625,1129.6761474609,11.1796875,"cylinder",3.0,0,255,0,100) addEventHandler("onClientMarkerHit", lottoStoreMarker, function( hitElement ) if hitElement == localPlayer then guiSetVisible(GUIEditor.window[1], true) showCursor(true) end end) end) addCommandHandler("lotto", function() local tickets = getElementData(localPlayer,"ticketsLeft") or 0 if tickets > 0 then openLoteryTicket() else outputChatBox("You don't have any lottery tickets !") end end) function openLoteryTicket() lotteryTickOpen = true guiSetVisible(GUIEditor.button[3], true) showCursor(true) addEventHandler("onClientRender", root, drawLoteryTicket) end function closeLoteryTicket() lotteryTickOpen = false lotteryTickScratchedOpen = false guiSetVisible(GUIEditor.button[3], false) showCursor(false) removeEventHandler("onClientRender", root, drawLoteryTicket) end function drawLoteryTicket() if lotteryTickOpen then dxDrawImage ( screenWidth/2-224.5,screenHeight/2-300, 449, 600, 'lotteryNotscratched.png') elseif lotteryTickScratchedOpen then dxDrawImage ( screenWidth/2-224.5,screenHeight/2-300, 449, 600, 'lotteryScratched.png') --lotoslots dxDrawText(tostring(randomNumbers[1]), 467, 290, 584, 402, tocolor(0,0,0, 255), 3.00, "default", "center", "center", false, false, true, false, false) dxDrawText(tostring(randomNumbers[2]), 613, 290, 730, 402, tocolor(0,0,0, 255), 3.00, "default", "center", "center", false, false, true, false, false) dxDrawText(tostring(randomNumbers[3]), 768, 290, 885, 402, tocolor(0,0,0, 255), 3.00, "default", "center", "center", false, false, true, false, false) dxDrawText(tostring(randomNumbers[4]), 467, 432, 584, 544, tocolor(0,0,0, 255), 3.00, "default", "center", "center", false, false, true, false, false) dxDrawText(tostring(randomNumbers[5]), 618, 432, 735, 544, tocolor(0,0,0, 255), 3.00, "default", "center", "center", false, false, true, false, false) dxDrawText(tostring(randomNumbers[6]), 768, 432, 885, 544, tocolor(0,0,0, 255), 3.00, "default", "center", "center", false, false, true, false, false) dxDrawText(tostring(randomNumbers[7]), 471, 562, 588, 674, tocolor(0,0,0, 255), 3.00, "default", "center", "center", false, false, true, false, false) dxDrawText(tostring(randomNumbers[8]), 622, 562, 739, 674, tocolor(0,0,0, 255), 3.00, "default", "center", "center", false, false, true, false, false) dxDrawText(tostring(randomNumbers[9]), 768, 562, 885, 674, tocolor(0,0,0, 255), 3.00, "default", "center", "center", false, false, true, false, false) end end
-
Of course ! Tell me where do you see 3 times the same value in this list ?! {2,4,6,8,10,12,14,16,18,20} I think your are going wrong, please explain exactly what you want to do. It looks like you are trying to make a lottery or a thing like this (I don't know the english name for that): But I don't understand why you are using the hardcoded list of possibilities as the "randomNumbers". I gave you a code that works and that I'm pretty sure it was what you were looking for. So please explain in details.
-
- Read the code - Try to understand the code - Modify the code - Test - Keep modifying untill it work. If all those steps fails, here is where you should start before creating your server: https://wiki.multitheftauto.com/wiki/Scr ... troduction
-
Not enough informations and code to help you. - we don't know what is aInputBox - we don't know what is source (which event) - we don't know what is aTab1.SetHealth (we can guess it's maybe a progressbar) - we don't know where the player variable comes from. - we don't don't what is aTab1.Health (we can guess it's maybe a label) So come back with more code if you want help.
-
Yes, why didn't you try ? All depends of the router configuration. Look at the following schema: VPS Server is hosting your database and VPS Server2 is hosting your mta servers. When your mta servers connect to your database using the public ip of VPS Server (123.123.123), Hoster Router2 knows the route to go to this ip. But if the mta servers are running on VPS Server and try to connect to itself (VPS Server) using its public ip (123.123.123), then if Hoster Router isn't configured to handle this case, he won't know who is 123.123.123.123. So to avoid going out of VPS Server and ask to Hoster Router, just use 127.0.0.1 or localhost as database ip. It will prevent useless bandwith usage between VPS Server and Host Router.
-
- splitreturns a table - You needed a table to store the random numbers and then iterate over it to look for 3 same values in it. local randomNumbers = {} for k=1, 9 do table.insert(randomNumbers, possibiltyThings[math.random(#possibiltyThings)]) end --check for 3 same values: local sameValueCount = {} for k, v in ipairs( randomNumbers ) do sameValueCount[v] = (sameValueCount[v] or 0) + 1 if (sameValueCount[v] == 3) then local amountToGive = split ( v, "k" )[1] -- *1000 ? exports.SARGcommands:giveMoney(localPlayer, tonumber(amountToGive)) break --stop looking for other 3 same value, remove it if you want to -- give cash for every 3 same values there are in randomNumbers. end -- reset sameValueCount = {} randomNumbers = {} end