Jump to content

[Basic Help With Scripting For Starters]


Recommended Posts

Ok i will explain to you how i started to learn scripting firstly i read the MTA:SA Scripting Wiki, Read it like 10 times then i made a GUI Rules Panel which they show you how to make, this is important don't just copy it because then you don't learn from copying also it's not a developed script by you then. Once you have read Wiki and you understand it then go to forum.multitheftauto.com and go to the scripting section and find and useful basic scripts that you can learn of. Or you can find some scripts you can learn of at community.multitheftauto.com. Here is an example below of a script i made with Wiki and other script ideas!

Note : This is one of my script also available on community!

Client Side

local testGrid = guiCreateGridList( 0.8, 0.6, 0.2, 0.03, true, testWindow ) -- guiCreateGridList( x axis, y axis, width, height, absolute/relative numbers, is it attached to something ) 
--right, lets make some labels that tell you a number of online players 
local testLabel = guiCreateLabel(  0.8, 0.6, 0.2, 0.04, 'Online Players: ', true, testWindow ) -- guiCreateLabel( x axis, y axis, width, height, name, absolute/relative numbers, attached to ) 
setTimer( -- lets create a timer 
function( ) -- timer needs a function 
guiSetText(testLabel, 'Online Players: '.. #getElementsByType('player')) -- set new text to stuff, for this instance to the label we created earlier 
end, 100, 0 -- lets end the function and set 100miliseconds to get the function executed, for infinity times 
) -- lets close the timer  
  

Meta.xml

type="script" decription="Online Players 1-100" name="Online Players" version="1.0" author="Gangsta"/> 

Ok this is a simple GUI script i had made my second script when i was new to scripting, it took me about approximatley 10-15 Minutes because i was new. Ok so here you go a simple start of scripting! Also still learning how to script btw not a pro yet! : D

Edited by Guest
Link to comment
  • 2 weeks later...

I know that the window isn't defined, but i still can see that he didn't create this, as i got this in one of my scripts for a long time, and the description is mine aswell, he once asked me about how to create scripts with gui's in it, i gave him the description and this kind of code.

Link to comment

You misspelled 'addEventHandler' (( you spelled 'addEventHanderl' ))

after all, i think this topic should be locked or deleted as he posted this code without me noticing about it, as this code is mine + description on it is mine (( i know description is bad ))

Link to comment
You misspelled 'addEventHandler' (( you spelled 'addEventHanderl' ))

after all, i think this topic should be locked or deleted as he posted this code without me noticing about it, as this code is mine + description on it is mine (( i know description is bad ))

It was a tribute to me (: Ahahah

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...