PDA

View Full Version : This sounds stupid, but I'm serious


Jonesy96
08/10/2011, 10:43 PM
Hi everyone,

As the subject says, this sounds stupid, but I am serious. Basically, I have been looking to learn how to script for a long time now. I have checked out so many tutorials and none of it seems to sink in. I'm the sort of person that learns through somebody teaching me, rather than me reading trough a book or through tutorials. Anyway, I'm looking for a scripter who is willing to dedicate some time to teaching me how to script. I realise it's a long journey, but I think that with a little time to start me off, I can find my own way. I can't be offering money for this, I'm looking for a kind hearted person that is willing to help a member of the community out. Please don't send me links to any tutorials as they don't help, but thanks anyway. If you feel nice, and are prepared to put in a little time and patience with me, then please send me a forum PM, and I'll be ever so grateful. I'm not expecting anyone to help me, so I'm not getting my hopes up, but it's worth a try.

Regards,

jonesyrhys96

=WoR=G4M3Ov3r
09/10/2011, 01:30 AM
How doesn't wiki.sa-mp.com help you ?, it helped everyone around here...

steki.
09/10/2011, 01:32 AM
It's not a long journey. They are just some variables and functions around here and there.

nilanjay
09/10/2011, 06:43 AM
Thats strange because every scripter here learned scripting from samp wiki. If you read it and try it then you can learn scripting.

GAMER_PS2
09/10/2011, 06:46 AM
I learned Beginning from wiki dude
if u want learn that means You Dont Concentrate What You DO
You Just Copy And Paste

Zh3r0
09/10/2011, 06:49 AM
I learned Beginning from wiki dude
if u want learn that means You Dont Concentrate What You DO
You Just Copy And Paste

I personally learned the basic of scripting by just copy pasting, and once day I decided to check what are those functions what those are doing, and what are the bugs that may occur by doing so so and that or this.
I only visit Wiki for ID's, such as weapon ids, pickup types etc...
Now I don't copy paste anymore, I just try and make my owns, and till now, since in 2009 I stopped copy pasting, I now do scripts out of what I know so far.

nilanjay
09/10/2011, 06:52 AM
Zh3r0 thats why you have a great result, You have 210 reputation :)

GAMER_PS2
09/10/2011, 06:53 AM
I personally learned the basic of scripting by just copy pasting, and once day I decided to check what are those functions what those are doing, and what are the bugs that may occur by doing so so and that or this.
I only visit Wiki for ID's, such as weapon ids, pickup types etc...
Now I don't copy paste anymore, I just try and make my owns, and till now, since in 2009 I stopped copy pasting, I now do scripts out of what I know so far.

yae u have 210 reputation cuz of that

Mr_Scripter
09/10/2011, 06:56 AM
Because Of ... Look On His Sig <.<

Zh3r0
09/10/2011, 07:02 AM
Because Of ... Look On His Sig <.<

I got my ways to earn reputation, I got some from the "The Eclipse" release, I got some from "0Admin" release, and many more useful posts I've done during my time here.
Yet, it's not like I've never spammed or been a dick, I even got a history of 5 infractions :D

Chenjiang
09/10/2011, 08:40 AM
Thats strange because every scripter here learned scripting from samp wiki. If you read it and try it then you can learn scripting.

Well, not every. Me, for example, i used a LARP copy and began changing random stuff in the script, looking for what happened. And then, i decided what i want to archieve, and edit the code with my experience, so as a result the code does more or less what i wanted. Wikis are only a source of ID's, Interiour Poistions ect, But for Functions i never used it. And thats what i can recommend to the Threads author, if he cant learn with a Tutorial - just use Trial and Error, and someday you'll find out what you are actually doing, and you will be able to read pawncodes just as if you read a book.

Jonesy96
09/10/2011, 01:17 PM
This is supposed to help me, not talk about sig's and rep :/ But thanks anyway. Like I said in the original post. I have read so many things, including sa-mp.wiki. None of it sinks in, which is what I also said.

Babul
09/10/2011, 02:23 PM
the wiki is handy when you already know how the syntax of commands is asembled, how the mechanisms of callbacks are working, if you can think deductive... you need to be able to split a problem into the smallest parts possible: think binary!
when starting to learn programming/coding/scripting, its a good idea to get used to the basic concepts and how, especially WHY, thigs are working. some knowledge about algorithms is vital for succeeding at some tasks, like a good sorting method. a programmer is always in need to think about the best (quickest/most efficient) way to do things, like

instead 500 timers, 1 per player, running 1000 ms each, will cause 500 callbacks per second, but 1 timer with a 500-player-loop inside, will not cause 500 wasted calls, its running a lot smoother.
using 1 more variable can solve some little problems, like /reply-ing to a /PM from a player:
imagine i send you a /pm. how can you reply to me when you have read it? with one extra per-player-variable, this is easy: simply set my (sender) playerid into a variable stored at "your side", lets call that variable "GotPmFrom":

//this is part of a /pm command: playerid is me (sender, using that command), and recieverid is your id:
SetPVarInt(reciever,"GotPMFrom",playerid);// writes my playerid (123) into your variable "GotPMFrom"

if you reply to my pm, then the script will access the palyerid (mine), stored in your variable -it would contain such a line:

new recieverid=GetPVarInt(playerid,"GotPmFrom");// my playerid (123) is inside your variable "GotPMFrom". this gets asigned to the recieverid, which can be used later:
SendClientMessage(recieverid,0xffffffff,"Yes, i have recieved yor PM");

learn how to search for something. who is the player with the most score/money in your server? since this affects ALL players, there is nothing but a linear search (check all players). but why? cause all players need to be taken attention? basically, yes. if you dont intend to use the "who is the best" each second, then a linear search is ok. but what if you want to do that trick like 100 times per second? then you should be prepared for:
sorting arrays is vital when you want to script fast algorithms. if you got a list which contains sorted data, then you can do a binary search on that list. you surely know that game:
i imagine a number between 1 and 100. and YOU need to guess that number. you dont want to waste time at doing a linear search here, like guessing:
"1?" - "higher." - "2?" - "higher." - "3?".....
that would take.. 100 max loops (worst case). looks silly, doesnt it? it is! :)
since you know that there is 1 value only, and that the array 1-100 IS sorted, you can use the binary search:
"50?" - "higher." - "75?" - "higher." - "87?" - "lower." - "81?" - "lower." - "78?" - "lower." - "77?" - "lower." - "76?" - you found my 76. using 7 guesses only. thats a bit fewer than 76, isnt it? ^^
yor "excluded" numbers as a simple text-statistic, could look like

1
0 1 2 3 4 5 6 7 8 9 0
12345678901234567890123456789012345678901234567890 12345678901234567890123456789012345678901234567890
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee--------------------------------------------------
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeeeeeeee-------------------------
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeeeeeeee-----------eeeeeeeeeeeeee
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeeeeeeee-----eeeeeeeeeeeeeeeeeeee
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeeeeeeee--eeeeeeeeeeeeeeeeeeeeeee
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeeeeeeeeXeeeeeeeeeeeeeeeeeeeeeeee


there are some nice topics about optimizing scripts by ******, they are worth reading each single line - containing tips for almost each aspect of scripting. this knowledge will influence all your scripting aswell, learning never stops :)

temporary: gtg, its a nice sunday after 2 days of /weather 8 here, so i will grab some fresh air now ^^
as soon i find some topics, i add them here. for now, search for "script ******". and read.. everything lol
temp-edit: the X marks the number found. 76. in 6 steps only (logarithm of 100 on a base 2?) brb

davve95
09/10/2011, 02:33 PM
I aslo had that problem but look on tuturails on Youtube thats helpt me alot :D