02.03.2010, 17:19
Im not sure this will work, you should have the stock strtok sumwhere unless ur a noob :P
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
if(strcmp("/hello", cmd, true)==0)
{
new tmp[128]; tmp = strtok(cmdtext, idx);
if(strlen(tmp))//If the player used params
{
new pName[MAX_PLAYER_NAME], iName[MAX_PLAYER_NAME];
new string[128];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(strval(tmp), iName, sizeof(iName));
format(string, sizeof(string), "%s says hello to %s!", pName, iName);
SendClientMessageToAll(color, string);//Change color
}
else if(!strlen(tmp))//If the player didnt use params
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "%s says hello to all!", pName);
SendClientMessageToAll(color, string);//Change color
}
return 1;
}
return 0;
}