Need some tips on how to convert my commands to YCMD - 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: Need some tips on how to convert my commands to YCMD (
/showthread.php?tid=357951)
Need some tips on how to convert my commands to YCMD -
Knappen - 08.07.2012
At the moment, all my commands are STRCMP or whatever it's called. I'm really want to convert them, because I have LOADS of commands, and well, you could say you notice that they process slow.
The thing is, I've never worked with YCMD or ZCMD before. I was thinking of converting to YCMD, searched a bit around, but couldn't find any decent tutorials, so I figured I should ask here for some help. If someone could just give me an example?
pawn Код:
if(strcmp(cmd, "/askq", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_INFO, "* Usage: /askq [text]");
return 1;
}
format(string, sizeof(string), "Question from %s: %s", sendername, (result));
ABroadCast(COLOR_ASKQ, string, 1);
SendClientMessage(playerid, COLOR_ASKQ, "Your Question Message was sent to the Admins.");
}
return 1;
}
This was the command which was at the top, so if you could please use this as an example. And please explain what you are doing, because I really want to learn how to do this myself, but if you do it for me, I'll never learn it.
Thanks in advance for all answers
Re: Need some tips on how to convert my commands to YCMD -
Knappen - 09.07.2012
No help to get here I guess...
Re: Need some tips on how to convert my commands to YCMD -
RedJohn - 09.07.2012
Read this, maybe you'll understand :
link
Re: Need some tips on how to convert my commands to YCMD -
Knappen - 09.07.2012
I read a little bit, but really can't understand it. Especially that sccanf thing.