SA-MP Forums Archive
Leader chat /le - 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: Leader chat /le (/showthread.php?tid=404471)



Leader chat /le - T_Boy - 03.01.2013

If I type something like "/le Hello!" it will send to the leaders: /le Hello!; not just Hello!
Please help me!

This is the code:
if (strcmp("/le", cmdtext, true, 3) == 0)
{
new
string[128],
leader[28],
text[100]
;

if(!IsLeader(playerid)) return SendClientMessage(playerid, COLOR_YELLOW, "You are not a leader!");
GetPlayerName(playerid, leader, sizeof(leader));
if(sscanf(cmdtext, "s[128]", text)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /le <text>");
format(string,sizeof(string),"*Leader %s: %s",leader,text);
SendClientMessageToLeaders(0xB6BAFFFF,string);
return 1;
}


Re: Leader chat /le - LarzI - 03.01.2013

That's because you use strcmp with sscanf. Try using y_cmd, zcmd or dcmd instead.