-
Posts
1,803 -
Joined
-
Last visited
-
Days Won
8
Everything posted by Citizen
-
Ok found this. Replace this: function buyMap(thePlayer,mapName,command) By this: function buyMap( thePlayer, command, mapName )
-
From my PMs: Ok I'll tell you again one more time: Here viewtopic.php?f=91&t=72258 in the 1st script, replace this line (l.23): triggerEvent("onBoughtMap",getRootElement(),mapName) by this: triggerEvent("doBuyNextMap", thePlayer, thePlayer, mapName) What's so complicated ?!
-
no, he said: local guiTable = getElementChildren(getResourceGUIElement()) It will return all gui elements from the current resource but only the guis that doest have a parent specified when using guiCreateX functions. So if you want then to get the children (buttons/edits/etc that has a parent) use the getElementChildren as I did on the resource gui element.
-
The answer: viewtopic.php?f=91&t=72512&p=671772#p671566 And no, this one should be locked, not the newest one.
-
edit the scripts to add this as the 1st instruction of the right functions: if not getElementData( player, "afk.withinZone" ) then return end but be sure to replace player by the right variable.
-
Stop using two topics for the exact same problem and reply to my question on the other one: viewtopic.php?f=91&t=72512&p=671772 Solid, could you lock this one please ?
-
Come on, don't make you look more stupid that you are (sorry if it's mean, but I wrote you EXACTLY what you had to do): (Took the code of WhoAmI but replaced the onHit function by mine) Server: addCommandHandler("afk", function () setElementPosition(localPlayer, 1904.8403320313, 717.12438964844, 49.214366912842) outputChatBox( "You are now in Afk zone", localPlayer, 0, 255, 0 ) setElementData(localPlayer, "afk.godmode", true) setElementData(localPlayer, "afk.withinZone", true) triggerServerEvent("afk.takeWeps", localPlayer) end ) function onHit() if (source and isElement(source) and getElementType(source) == "player") then if (getElementData(source, "afk.godmode") == true) then cancelEvent() end end end addEventHandler("onClientPlayerDamage", root, onHit) Client: function takeWeps() takeAllWeapons(source) end addEvent("afk.takeWeps", true) addEventHandler("afk.takeWeps", root, takeWeps)
-
No ... It's a custom radar, so it's obvious the original has to be hidden. By the way, this guy just want us to write the code to add blips and radar areas on this custom radar he stolen/copied from somewhere. But it's not gonna happen since it requires too much time and he isn't alone on this forum. Also I aready helped someone to do the exact same thing: viewtopic.php?f=91&t=71784
-
Wow such a usefull post for us ... What's the problem ? - you didn't understand what I asked you to do ? - you understood and replaced correctly but my code isn't working ? - you didn't understand my code but it's working ? And we would like to see the errors too.
-
Bonjour Latitepingouin, Alors en supposant que tu as une texture que tu aurais téléchargé sur internet (un .txd) et placé dans le dossier skins dans le dossier de ta ressource: Il faut d'abord ajouter le fichier monFichier.txd dans la meta.xml <file src="skins/monFichier.txd" /> Ensuite, il faut créer un nouveau script (par exemple customSkins.lua) dans le dossier de ta ressource et l'ajouter dans ta meta.xml: <script src="customSkin.xml" type="client" /> Dans ce script, il va falloir charger le nouveau skin et remplacer un skin existant par celui là lorsque le script du joueur démarre: function loadCustomSkin() local txd = engineLoadTXD ( "skins/monFichier.txd" ) --on charge la texture depuis son fichier engineImportTXD ( txd, 0 ) -- on import cette texture en remplaçant la texture du skin 0 (celui de CJ) end addEventHandler("onClientResourceStart", root, loadCustomSkin) -- on executera loadCustomSkin lorsque le script se charge pour un joueur Et il nous faudra une autre fonction qu'on peut placer dans le même fichier pour rester simple et qui va donner le skin perso aux personnes autorisées. Je te file du code tout prêt donc je te demanderai au moins de lire TOUS les commentaires pour bien comprendre à quoi sert chaque ligne. C'est le minimum que je demande. -- je crée ici un tableau à une colonne (donc en gros un liste simple) avec les noms des personnes autorisées. local allowedPlayers = { {"latitepingouin"}, {"Citizen"}, {"KillerDu69"} -- le dernier élément d'une liste ne doit pas avoir de virgule } function setMySkin( cmd, skinID ) if not skinID then -- Si le joueur n'as pas précisé l'id qui voulait, alors return --on arrête la fonction ici en faisant un return end skinID = tonumber( skinID ) -- quand on récupère les donnée envoyer par une commande, on récupère du texte donc faut le transformer en nombre local playerName = getPlayerName( localPlayer ) --on récupère le nom du joueur sur lequel ce script s'éxécute --on appelle notre fonction isPlayerAllowed pour savoir s'il fait partit de notre tableau des personnes autorisées local allowed = isPlayerAllowed( playerName ) -- allowed vaudra true ou false s'il est autorisé ou non if allowed then -- s'il est autorisé (c'est la même chosew que de faire: if allowed == true then) setElementModel( localPlayer, skinID ) --on donne le skin au joueur end end addCommandHandler("pskin", setMySkin, false) --on ajoute notre commande /pskin qui appellera setMySkin function isPlayerAllowed ( playerName ) --on parcours le tableau des personnes autorisées grâce à cette boucle: for k, allowedName in ipairs ( allowedPlayers ) do if allowedName == playerName then --si on a trouvé dans la liste le même nom qu'on cherchait alors: return true --on renvoie true (vrai), (le return arrête la fonction je le rappelle) end end -- donc si le code arrive ici ça veut dire qu'on a parcouru le tableau en entier et donc qu'on a pas trouvé le nom dans la liste return false --on renvoie false (faux) end Il te faudra donc utiliser /pskin 0 pour avoir le skin 0 qui correspond à celui de CJ, mais comme on l'a remplacé par notre skin custom, tu obtiendra ce nouveau skin. (j'ai utilisé "pskin" pour "private skin", tu peux changer le nom si tu veux mais évite d'utiliser une commande qui pourrai être susceptible d'être déjà utilisé dans un autre script. Par exemple la commande "skin" y a 90% de chances qu'elle soit déjà utilisé.) Si jamais ça ne marche pas, j'aimerai avoir les erreurs éventuelles que tu pourras voir ingame en utilisant /debugscript 3. Pour utiliser cette commande, il te faut d'abord t'enregistrer en faisant /register mdp mdp que tu stoppes ton serveur complètement, modifie ensuite acl.xml (même endroit que mtaserver.conf), tu recherches ton nom dedans. Tu devrais trouver une ligne comme ceci: <object name="user.latitepingouin"/> il te faut la déplacer dans le groupe admin: <group name="Admin"> ... <object name="resource.admin"/> <object name="resource.webadmin"/> <object name="user.latitepingouin"/> </group> Relance le serveur et ensuite ingame fait /login mdp Et s'il y a une erreur, je veux l'erreur complète ! (y en a beaucoup qui ne mette pas la fin en pensant que ça nous est pas utile et on est obligé de deviner). Voilà en espérant que ça marche du premier coup.
-
Omg, your code is totally dirty ! Copy this code again: Lines 23 to 27 has to be on serverside. and replace lines 12 to 19 by mine:
-
Should use source the player that have been hit, not the attacker: function onHit() if (source and isElement(source) and getElementType(source) == "player") then if (getElementData(source, "afk.godmode") == true) then cancelEvent() end end end addEventHandler("onClientPlayerDamage", root, onHit)
-
attempt to perform arithmetic on a boolean value
Citizen replied to vn007322815's topic in Scripting
At line 49: function createTankTable ( player ) if source and not player then player = source end setElementData(player,"playerTanks",{"no","no","no","no","no","no","no","no","no"}) setElementData(player,"spawnedtanks",0) end addEventHandler("onPlayerJoin", root, createTankTable) -
You need to use a variable to store it like the wiki did. And then use that variable as 1srgument of getTimerDetails. Don't use infinite timer if you want to know if the 5 mins are passed (oh and 5 mins = 5 * 60 secs = 300 * 1000 ms = 300000 ms) in the case of a non infinite timer, getTimerDetails will return false when the timer is done (passed 5 mins).
-
[quote name=..&G:..]if you don't have a mysql database, you can get one from http://www.db4free.net Didn't know that website but : So be carefull with this website.
-
I have to apologies then. By the way you had to end with this code if you had read carefully (but I'm agree there were a lot of suggestions that were only fixing 1 thing at a time). So now you can remove the useless outputs (but I'm sure you already did it, which is good). But don't forget that outputs are really usefull to check where the execution process is going in the script and where it doesn't. Keep it up
-
I commented two lines, they weren't supposed to be restored by you ... Please read instead of randomly copying, so again: triggerClientEvent ( thePlayer, "test", thePlayer) and function guiwindow () outputChatBox("4 - guiwindow") if isPedInVehicle( localPlayer ) == true then return end outputChatBox("5") -- if (getElementType ( source ) == "player") then --not needed anymore outputChatBox("6") guiSetVisible(GUIEditor.window[1], true) showCursor ( true ) -- end outputChatBox("7 - end guiWindow") end addEvent( "test", true ) addEventHandler( "test", root, guiwindow ) And once again, do not modify the comments !
-
Modify the other code instead of the Race resource: triggerEvent("doBuyNextMap", thePlayer, thePlayer, mapName)
-
Nope and this is worst because you are using the root element which is a bad practice: And the problem was in the client side (using thePlayer instead of localPlayer or source because thePlayer isn't sent as 1st parameter (4th argument of triggerClientEvent
-
You already said it yeah, but what about the output you did ? is is shown in the chatbox ? And when I said to put some outputs I didn't mean only one, this is what you should write: function pedclick ( theButton, theState, thePlayer ) outputChatBox("1 - pedclick") local clickedElement = source if clickedElement == policeped and theButton == "left" and theState == "up" then outputChatBox("2 - trigger") triggerClientEvent ( thePlayer, "test") end outputChatBox("3 - end pedclick") end addEventHandler( "onElementClicked", root, pedclick ) function guiwindow ( thePlayer ) outputChatBox("4 - guiwindow") if isPedInVehicle(thePlayer) == true then return end outputChatBox("5") if (getElementType (thePlayer) == "player") then outputChatBox("6") guiSetVisible(GUIEditor.window[1], true) showCursor ( true ) end outputChatBox("7 - end guiWindow") end addEvent( "test", true ) addEventHandler( "test", root, guiwindow ) Are you sure that it's policeped and not Policeped ?? if yes, then it's okay. You said that there were no error in debugscript ?! The triggerClientEvent is wrong, here is what you should do: triggerClientEvent ( thePlayer, "test", thePlayer) If you really didn't get any error then it means there is a problem here: if clickedElement == policeped and theButton == "left" and theState == "up" then Here is the client-side script to make guiwindow works with out triggerClientEvent: function guiwindow () outputChatBox("4 - guiwindow") if isPedInVehicle( localPlayer ) == true then return end outputChatBox("5") -- if (getElementType ( source ) == "player") then --not needed anymore outputChatBox("6") guiSetVisible(GUIEditor.window[1], true) showCursor ( true ) -- end outputChatBox("7 - end guiWindow") end addEvent( "test", true ) addEventHandler( "test", root, guiwindow ) Hope that this time, it will work
-
Tell us why and what you are really trying to do. Because for me it doesn't really make sense.
-
Hummmm KRZO .... Taken from viewtopic.php?f=91&t=72059#p667863Thought you got it and that it was "more clear": And dbPoll is already doing the mysql_fetch_assoc for you since it returns the result as a table like mysql_fetch_assoc does.