21.09.2012, 03:52
Quote:
This script gives like 26 errors xD. :P Can someone try to fix it?
|
Note:you need foreach and sscanf2 include.
All credits to SouthClaw.
pawn Code:
CMD:w(playerid, params[])
{
// The entire string minus the '/', 'w'and ' ' should be 125 max right?
new wtext;
if(sscanf(params, "s[125]",wtext)) return SendClientMessage(playerid, 0xFF0000, "Usage: /w [whisper text]");
// A counter to check how many players the message was sent to
// in order to give a return message if the player is just talking to no one.
new count[MAX_PLAYERS];
foreach(new i : Player)
{
if(IsPlayerInRangeOfPoint(i, WHISPER_RANGE, x, y, z) && i != playerid)
// If the currently iterated player ID is near the player who typed the command
// And the iterated player ID doesn't equal the command player ID, proceed:
{
SendClientMessage(i, 0xF2F5A9FF, "***%d {FFFFFF}whispers: {F2F5A9}%s", playerid, params);
count[playerid]++;
}
}
if(count[playerid] == 0 ) return SendClientMessage(playerid, 0xFF0000, "None can't hear you! You will be forever alone. :c");
return 1;
}