27.05.2012, 12:07
Waddup forums, got some problems for you to solve.
I'm using zcmd and sscanf.
I got problems with the /me, /do and /®adio commands, while using /me and /do the name doesnt appear, and when my friend send a message through the /radio it shows up as me sending it.
And none of the commands work when the string is long.
GetName function:
Radio code:
In-game results:

(hoping on answer from Alex because he probably knows what the error is)
I'm using zcmd and sscanf.
I got problems with the /me, /do and /®adio commands, while using /me and /do the name doesnt appear, and when my friend send a message through the /radio it shows up as me sending it.
And none of the commands work when the string is long.
pawn Code:
CMD:me(playerid, params[])
{
new text, str[128];
if(sscanf(params, "s", text)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /me [text]");
format(str, 128, "* %s %s", GetName(playerid), text);
SendClientMessageToAll(lightblue, str);
return 1;
}
CMD:do(playerid, params[])
{
new text, str[128];
if(sscanf(params, "s", text)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /do [text]");
format(str, 128, "* %s ((%s))", text, GetName(playerid));
SendClientMessageToAll(cyan, str);
return 1;
}
pawn Code:
stock GetName(playerid)
{
new name[24];
GetPlayerName(playerid, name, 24);
return name;
}
pawn Code:
CMD:r(playerid, params[])
{
new text;
if(sscanf(params, "s", text)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /®adio [text]");
foreach(new i:Player)
{
if(gTeam[playerid] == LSPD)
{
if(gTeam[i] == LSPD)
{
new str[128];
format(str, 128, "(Radio) %s: %s", Name(playerid), text);
SendClientMessage(i, 0x00FF00FF, str);
}
}
else SendClientMessage(playerid, 0xFF0000FF, "Error: You need to be a cop to use this!");
}
return 1;
}
CMD:radio(playerid, params[])
{
return cmd_r(playerid, params);
}

(hoping on answer from Alex because he probably knows what the error is)