SA-MP Forums Archive
help with whisper - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help with whisper (/showthread.php?tid=237104)



help with whisper - tanush - 09.03.2011

im trying to make /w (whisper) but i always get player is not point of range while they are near
pawn Код:
COMMAND:w(playerid, params[])
{
    new id,string[128], text[64], Float:dpX, Float:dpY, Float:dpZ;
    if(sscanf(params, "s[64",string, text)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /w [text]");
    if (!IsPlayerInRangeOfPoint(id, 10, dpX, dpY, dpZ)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Nobody is in point of range!");
    GetPlayerName(playerid, string, sizeof(string));
    format(string, sizeof(string), "%s whispers: %s", string, text);
    SendClientMessage(id,0x10F441AA, string);
    return 1;
}



Re: help with whisper - JaTochNietDan - 09.03.2011

That's because you're checking the distance to the co-ordinates of the player who's ID is the value of "id", which is not specifically defined by you, therefore by default it is 0. So you're comparing the location of ID 0 with dpX, dpY and dpZ which have no locations stored in them, yet again, they are defaulted to 0.0000.

Do you see the problem here? For such a command, you need a loop which will go through the players and send them the message each if they are in range.


Re: help with whisper - tanush - 09.03.2011

ohhh lol thanks JaToch