how to do ZCMD+sscanf convert ? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: how to do ZCMD+sscanf convert ? (
/showthread.php?tid=258907)
how to do ZCMD+sscanf convert ? -
VivianKris - 02.06.2011
Hi guys ,I have some problems about ZCMD.
How to convert this to ZCMD+sscanf?
Код:
if(strcmp(cmd, "/b", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(pInfo[playerid][pLogged] != 1)
{
SendClientMessage(playerid, COLOR_GREY, "* You havent logged in yet!");
return 1;
}
GetPlayerName(playerid, pName, sizeof(pName));
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(playerid, COLOR_GREY, "USAGE: /b [Local OOC Chat]");
return 1;
}
format(string, sizeof(string), "(( %s: %s ))", pName, result);
ProxDetector(12.0, playerid, string,COLOR_CHAT4,COLOR_CHAT4,COLOR_CHAT4,COLOR_CHAT4,COLOR_CHAT4);
printf("%s", string);
}
return 1;
}
And
Код:
if(strfind(plname,"_",true,1)!=-1)
{
RPName = 1;
}
Please help me , thanks a lot.
Re: how to do ZCMD+sscanf convert ? -
Calgon - 02.06.2011
You won't need sscanf for that because it only retains 1 parameter (a string), but you could do with the isnull function.
pawn Код:
CMD:b(playerid, params[]) {
if(isnull(params))
return SendClientMessage(playerid, COLOR_GREY, "USAGE: /b [Local OOC Chat]");
if(pInfo[playerid][pLogged] != 1)
return SendClientMessage(playerid, COLOR_GREY, "* You havent logged in yet!");
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "(( %s: %s ))", pName, params);
ProxDetector(12.0, playerid, string,COLOR_CHAT4,COLOR_CHAT4,COLOR_CHAT4,COLOR_CHAT4,COLOR_CHAT4);
printf("%s", string);
return 1;
}