kieran

Members
  • Content Count

    373
  • Joined

  • Last visited

Everything posted by kieran

  1. Yet no new guys seem to use code snippets now... Maybe add some kind of detection for code and if it's there, like a function... Then it'd make a popup suggesting the code snippet button?
  2. @Medwar the first one there DOES set the players stats to max, in San Andreas there is a limit for these skills, if it got current skills and they were 500+ then it worked. The code is there now you need to go and make something so I can get a better of idea of what you are trying to do, for me that set my full stats. Go and look at the wiki, see if you can make it work the way you want it to.
  3. kieran

    help

    @GalactixI read his script wrong, I thought the bracket was at the end of the function... Nesting is the second example he gave on original post, where you just put the word function under or beside the element that is triggering handler (separated by a comma of course), and then you add a closing bracket at the end of your function, below it or as most do (as it's proper way), you add it to the end of the last end in that function.... If that makes sense. I forgot to take that line out my post when I edited it.
  4. You seem like a new scripter, so one more thing... Check IIYAMA's topic where he explains the element tree, it is very useful.
  5. kieran

    help

    When nesting a function in an event handler like this, don't use the function name. Just do the following. addEventHandler("onPlayerChangeNick", getRootElement(),wasNickChangedByUser)--wasNickChangedByUser is the function name. function wasNickChangedByUser()--removed onPlayerChangeNick, within these brackets you only pass returns from event handlers, functions etc. outPutChatBox ( " Your have been changed your nickname " ) end oldNick and newNick are what this event handler returns, an event handler is just something that happens when a player does a certain action (or event) and it handles that event with the function. So when the function happens the event handler passes the players old name, and new name to the function. Make sure you check the returns part of wiki page. Hope that made it a bit clearer to you.
  6. You are adding event handler wrong, change the last line to addEventHandler("onPlayerLogin", root, setNickToAccount), please look at addEventHandler page on wiki, it explains why you use an element at argument 2.
  7. Yet I still don't know what you want to do with this script, please explain your goal and then I can see where you are going wrong.
  8. @NodZen_42 Try to use getPlayerTeam instead, this is both server and client side, and very reliable. local screenW, screenH = guiGetScreenSize() function drawTheImage () dxDrawImage(100, 100, 40,40,"mercenarios.png") end function teams_images () local playersTeam = getPlayerTeam(localPlayer) local TeamName = getTeamName ( playerTeam ) if TeamName == "Mercenarios" then addEventHandler("onClientRender", root, drawTheImage) outputChatBox('Player is in that team.') --Output a message to check if the script is working and you can't see the image. end end addEventHandler("onClientPlayerSpawn", getLocalPlayer(),teams_images) Apologies if this is wrong, very sleepy. It is untested but I can test it and try make it work if needed. I forgot to mention something VERY important, dx images and anything dx (directX) based, is drawn every frame. So if you just do it when the player spawns, that image is drawn for 1 frame, not for the duration the player is spawned. Now to solve this you can use onClientRender, this will check every frame and make sure the image is there, loading it on every frame until you remove the event handler with removeEventHandler.
  9. Is that the whole script? It seems that you have passed a string to the spamEngelle function, so "oyuncu" is now a string of text and not the player element. Are you using a command to trigger that function? Keep in mind I still have no idea at all what you are trying to do with this script... As I do not speak Turkish. But I will try and help.
  10. Please read thoroughly through this page in the wiki, it explains how you can start making your own scripts. Or look up scripting on MTA on YouTube, here is a quick YouTube video I just found. I hope this helps you!
  11. I not speak the Turkish , but if I am correct you are having troubles retrieving a players serial... For me your script is EXTREMELY confusing as I only speak English... So all I can tell you for now is to look at the returns from your event handlers. That and also to make sure you get the players account/element data (or whatever you use), so that you can pass it into the function. Please use /debugscript 3 and then we can get a better idea of the error... What line is the error coming from? What error are you getting? And finally what are you doing when you get this error? Please write back in English or use google translate.
  12. kieran

    On click icon

    You'll need to first create a function before the GUI is created. Now use GuiGetPosition to get the position of the image clicked (in your new function the image will be the source that triggered it), after this you just destroy the image (in new function) like this: destroyElement (source) Why create a function BEFORE the GUI is made I hear you ask? Well the way a computer reads code is top to bottom, so if you try pass a function, boolean or variable before it knows that it's there, it will get confused and say it's not there. Simple! Now that you have got the position of that image when you clicked it (remember you need "x,y = guiGetPosition (source)"), you can create your new image there. If you need an example I can try (please try yourself first), but I am very lazy today. Also please use these for code '<>' it helps us see your code more clearly as it is colored, just like in notepad++. I hope this helps you!
  13. You actually want setPedStat, setPlayerStat is the old one. And forget the table... If you just wish to set weapon stats, as I have previously said they are ID's 69-79. If you want to SET player stats for all weapons when that player spawns use the following script. function setStatsOnSpawn () for i = 69,79 do --We use a for loop to go through stats 69-79 (all weapon stats you can set) stat = setPedStat ( source, i, 1000 ) --We set the stat to full for the player (1000) end end addEventHandler("onPlayerSpawn", getRootElement(), setStatsOnSpawn) --When player spawns we trigger function basically in that for loop i = 69, then the stat for ID 69 is set to 1000. After that i = 70, and it keeps going until i reaches 79. To get all players weapon stats on spawn use the script I posted earlier function tellStatsOnSpawn () for i = 69,79 do --We use a for loop to go through stats 69-79 stat = getPedStat ( source, i ) --We get the stat from the source (the player) outputChatBox ( stat, source ) --And we output each stat to players chat end end addEventHandler("onPlayerSpawn", getRootElement(), tellStatsOnSpawn) --When player spawns we trigger function As you can see they are almost identical, but you don't need to get their max stat as we already know: THE MAX STAT OF ALL SKILLS IS 1000
  14. Yes what that script done was got the players CURRENT weapons stats, not their max weapon stats (I read your post wrong)... What exactly are you trying to do? Are you trying to get the max stats for all weapons? You can only set the stats of the following weapons. Weapon skills: Note: see Weapon skill levels for the values that advance weapon skills. 69: WEAPONTYPE_PISTOL_SKILL 70: WEAPONTYPE_PISTOL_SILENCED_SKILL 71: WEAPONTYPE_DESERT_EAGLE_SKILL 72: WEAPONTYPE_SHOTGUN_SKILL 73: WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL 74: WEAPONTYPE_SPAS12_SHOTGUN_SKILL 75: WEAPONTYPE_MICRO_UZI_SKILL 76: WEAPONTYPE_MP5_SKILL 77: WEAPONTYPE_AK47_SKILL 78: WEAPONTYPE_M4_SKILL 79: WEAPONTYPE_SNIPERRIFLE_SKILL I was wrong, it seems the max level for all weapons is 999, but the script I had was different... But please tell me more about what you want to do with your script... Are you trying to get all weapon stats of all players in game?
  15. Apologies for double post, but the above post can no longer be edited. It appears there is no native function to get peds full stat, but after some quick research. All weapon stats on the getPedStat function have a maximum of 999 skill, except for pistol, sawn-off and micro-uzi which have a max skill of 500. So all weapon stat (EXCEPT for stat IDs 69, 73 and 75: Limit for these is 500) have a limit of 999.
  16. But will this not remove the wires from map?
  17. https://wiki.multitheftauto.com/wiki/OnPlayerSpawn https://wiki.multitheftauto.com/wiki/GetPedStat (use 69-79) From what I understand you want something like this.... function tellStatsOnSpawn () for i = 69,79 do --We use a for loop to go through stats 69-79 stat = getPedStat ( source, i ) --We get the stat from the source (the player) outputChatBox ( stat, source ) --And we output each stat to players chat end end addEventHandler("onPlayerSpawn", getRootElement(), tellStatsOnSpawn) --When player spawns we trigger function I have tested this and it works, but not 100% sure what you want to do. Note that you will have to get the weapon names/IDs yourself. If you need help with these functions check wiki links then ask if still stuck, hope it helps. _________________ Edit Sorry, I misread your post... This will only get the players current weapon stats, I have no clue how to get the max stat and can't find anything on wiki either. It might be hard-coded into GTA itself.
  18. I know that this is a nuisance... But would it be possible to replace the dff, col and txd of 1 single object instead of all objects with that ID? For example... If I created an object server side, could I pass that object to the client and only mod that one object? If not is there a way of adding new model IDs so I could create a new object as if it was from the original GTA list? I ask this as I am planning to modify a lot of objects in game, but only in certain places. If there is no way to do this, does anyone know where I can find a list of objects that were added to the game but not actually used? Thanks
  19. I have both SA Tools and kams script, there is now no problems with collision files, only dff and txd, check this topic for a more detailed explanation to how I made the object, applied textures etc.... I do not know where I am going wrong Also thanks for help with kams, that col system confused me a lot.
  20. I have been struggling now for months... I am trying to just make a simple object, with multiple textures that a player can enter... The collision (.col) loads fine, and works as expected, there is problems with the texture though and I think it might lay within the dff file when I exported it. To make this object I first made 1 floor and 1 wall, I then cloned the wall 3 times to make a box open at the top, I gave each of these cloned objects and the original one a name (front wall, back wall etc). After this I cloned the floor, I moved it up and cut a hole in the cloned object (now the first floor), I then modified the bottom floor so it had a ramp, made a cut in the front wall so the player could enter, and then I added my images. When adding the images, I clicked the little box next to "Diffuse" in the compact material editor, I chose bitmap and imported a .tga image. I used the same material on the bottom and top floors, a different one for the roof, and also added stairs (just made boxes up to the hole in the top floor) and I COPIED the bitmap using the same .tga and applied tiling to it, I obviously had everything to editable polys, so I selected faces on the outside walls, and applied a brick texture, I then applied another wallpaper texture to the inside (using the tiling function in coordinates to modify it), I also applied tiling to the ramp on the first floor, I detached it and applied the tiling, then attached it again to the original place (copying the floors bitmap once more). I opened the slate editor and changed the name of all the bitmaps. I attached all the objects to form one single object, then I exported the DFF and COL with SA Tools, I then use col editor 2 to make the col shape. When making the texture (.txd) I just used the images I used in 3DS Max, I gave them the names of the .tga image and set them all to compressed. But it is still not loading the txd saying there is problems. Should I use a different image for each bitmap, or is it okay using the same one with UV tiling for each bitmap?
  21. This brings me back to the same point, what is your goal with this script? I can't help you until you help me understand what you are trying to do.
  22. You have declared "theVehicle" to be a function, it is not a function in your script. Please tell us what you're trying to do with this script, from what I can see you have tried to bind a key to a vehicle, it MUST be a function or a command.
  23. I have made a simple script to stop people advertising servers, it also converts all caps chat to lower case chat... There is of course many problems with this. Firstly, I need to use outputChatBox and fake the players chats when I convert upper case to lower case, so I need to get their name and output it with the text... This works okay, but I've noticed the original chat script is a little more complex, it gets the players nametag color and name, and outputs them... Is there a native event to output chat like the player sent it such as: "triggerServerEvent('outputChatBox', localPlayer, some-text)" or do I need to do it the way in the below script? (see line 25) Also when the player uses lower case hexadecimal codes, it thinks that it is part of the text and not a color code, is their a way of ignoring the hex code? So could I remove the string but also check it's a hex code and not something stupid like '#lol'? My script is below and it is server side for now, but I think it would work better client side (if their is a custom event for outputting chat) strings = { --try entering "mtasa" or "server" in game and see what happens! {'mtasa://', 'DO NOT ADVERTISE IP!'}, --string_to_find[1], message_to_show_player[2] {'SERVER', 'DO NOT ADVERTISE SERVERS!'}, } function checkText( message, messageType ) if messageType == 0 then for i=1,#strings do string_to_find = strings[i][1] message_to_show_player = strings[i][2] findstring = string.find(tostring(string.upper(message)),tostring(string.upper(string_to_find))) if findstring then cancelEvent() outputChatBox(tostring(message_to_show_player), source, 255, 0, 0) return false --stops here if player is advertising, otherwise it will check for caps in chat. end end --Below is anti-caps script capsfree = string.match(tostring(message), '%l') local name = getPlayerName ( source ) if not capsfree then cancelEvent() outputChatBox(tostring(name)..': #E7D9B0'..string.lower(message), _,231,217,176,true) --HERE is where I want to make it as if the player sent the chat end --anti-caps ends here end end addEventHandler("onPlayerChat", root, checkText) Thanks for any help in advance.
  24. Sorry can't edit last post, but now I want to take it further and convert uppercase letters to lowercase, I've done this and it works with %l, my issue is that I don't know how I'd send it as if the player typed it to all other players, is there a native function to output a message like this or would I need to get the players name and tag color and do it manually? I know I can do just "outputChatBox(message)" on server side and all will see it, but would I need to add name and color to the start of that message? Or is their an easier way? function checkCaps( message, messageType ) if messageType == 0 then capsfree = string.match(tostring(message), '%l') --%l will check for lower case letters if not capsfree then --If there is no lower case letters cancelEvent() outputChatBox(string.lower(message)) --Then convert the string to lower case end end end addEventHandler("onPlayerChat", root, checkCaps)
  25. @Fist Thanks so much! For anyone wanting a sort of early version of the script I'm making or that's struggling for an answer, here is the working code. strings = { {'mtasa://', 'DO NOT ADVERTISE'}, --tablesting[1], outputmessage[2] } function checkText( message, messageType ) if messageType == 0 then for i=1,#strings do tablestring = strings[i][1] outputmessage = strings[i][2] findstring = string.find(tostring(message),tostring(tablestring)) if findstring then cancelEvent() outputChatBox(tostring(outputmessage), source, 255, 0, 0) end end end end addEventHandler("onPlayerChat", root, checkText)