23.02.2010, 20:41
I have yet to understand why people insist on using that method of getting the single-stringed parameters of a player's command
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmd, "/ooc", true,4) == 0 || strcmp(cmd, "/o", true,2) == 0)
{
//if(IsPlayerConnected(playerid)) //Redundant, a player can't type a command if he isn't connected to the server
if(gPlayerLogged[playerid] == 0)return SendClientMessage(playerid, COLOR_GREY, " You havent logged in yet !");
GetPlayerName(playerid, sendername, sizeof(sendername));
new space=strfind(cmdtext," ");
if(!strlen(cmdtext[space])||(space==-1))return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/o)oc [ooc chat]");
format(string, sizeof(string), "(( %s: %s ))", sendername, cmdtext[space]);
printf("%s", cmdtext[space]);
return 1;
}
}