SA-MP Forums Archive
What this Means ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What this Means ? (/showthread.php?tid=300905)



What this Means ? - Black Axe - 02.12.2011

Well.. As you see - I am still learning Pawno language.. Anyway - I Was checking some basic Scripts and i found this :

PHP код:
            GetPlayerName(playeridsendernamesizeof(sendername));
            new 
length strlen(cmdtext);
            while ((
idx length) && (cmdtext[idx] <= ' '))
            {
                
idx++;
            }
            new 
offset idx;
            new 
result[64];
            while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
            {
                
result[idx offset] = cmdtext[idx];
                
idx++;
            }
            
result[idx offset] = EOS;
            if(!
strlen(result))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /report [text]");
                return 
1;
            } 
i Really got no idea what : EOS - Offset - idx - idx++ - new length = strlen(cmdtext); means and do ? I Tried reading wiki.samp but.. it's really complicated , Anyway - Any help would be Appreicated


Re: What this Means ? - Dark_Kostas - 02.12.2011

What this code actually does is to store anything after the command into a var called "result". So if you type something like "/report hi mom bla bla bla", the result will be "hi mom bla bla bla".

This code was used mostly on GF modes in most of the commands having parameters like that(or other commands like /o /i /b).

Now there are more optimised ways to make a command, like a combination of ZCMD and sscanf


Re: What this Means ? - imran.ali))PK(( - 02.12.2011

hey..can some one teach me scripting for middle level ?