What this Means ?
#1

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
Reply
#2

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
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)