Jump to content


  • Posts

  • Joined

  • Last visited

1 Follower

About kieran

  • Birthday August 21


  • Gang
    n/a, I am a cat!
  • Location
    United Rainy Kingdom.
  • Occupation
    Normal player that likes to help scripters.
  • Interests
    lua, C#, Python, Java, learning about new things on MTA, helping servers by looking for bugs, helping players with scripts.

Recent Profile Visitors

2,668 profile views

kieran's Achievements

Street Cat

Street Cat (24/54)



  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


    @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


    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. 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.
  • Create New...