Command: Message on radius
#1

i tried to make command which will send message players in radius, bbut here is bug, it send only to me :/

Код:
CMD:e(playerid, params[])
{
	new tekst[128], string[128], id;
	new Float:x, Float:y, Float:z;
	if(PlayerInfo[playerid][pAdmin] < 1)return SendClientMessage(playerid, COLOR_WHITE, "Niste ovlasteni");
	else if(sscanf(params, "s[128]", tekst))return SendClientMessage(playerid, COLOR_WHITE, "/e [Tekst]");
	GetPlayerPos(playerid, x, y, z);
 	if(IsPlayerInRangeOfPoint(playerid, 50.0, x, y, z))
 	{
		format(string, sizeof(string), "(( Admin %s: %s ))", PlayerName(playerid), tekst);
		SendClientMessage(id, -1, string);
	}
	return 1;
}
Reply
#2

Try this:

pawn Код:
CMD:e(playerid, params[])
{
    new tekst[128], string[128], id;
    new Float:x, Float:y, Float:z;
    if(PlayerInfo[playerid][pAdmin] < 1)return SendClientMessage(playerid, COLOR_WHITE, "Niste ovlasteni");
    else if(sscanf(params, "s[128]", tekst))return SendClientMessage(playerid, COLOR_WHITE, "/e [Tekst]");
    GetPlayerPos(playerid, x, y, z);
    format(string, sizeof(string), "(( Admin %s: %s ))", PlayerName(playerid), tekst);
    ProxDetector(50.0, playerid, String, -1);
    return 1;
}
Reply
#3

new error

Код:
C:\Users\toni\Desktop\Gang War Los Santos 0.3e\gamemodes\mod2.pwn(2827) : error 017: undefined symbol "ProxDetector"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#4

Woops.
Add this stock to the bottom of the script.

pawn Код:
stock ProxDetector(Float:radi, playerid, string[], color)
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInRangeOfPoint(i, radi, X, Y, Z))
        {
            SendClientMessage(i, color, string);
        }
    }
}
Reply
#5

Код:
C:\Users\toni\Desktop\Gang War Los Santos 0.3e\gamemodes\mod2.pwn(2827) : error 017: undefined symbol "String"
Код:
stock ProxDetector(Float:radi, playerid, string[], color)
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);

    foreach (new i : Player)
    {
        if(IsPlayerInRangeOfPoint(i, radi, X, Y, Z))
        {
            SendClientMessage(i, color, string);
        }
    }
}
Reply
#6

It cant be in that code because the error says String and there is no string with a capital in that. So locate the String with the capital and replace it with lowercase letters. aka string

Here it is:

Use this command.
pawn Код:
CMD:e(playerid, params[])
{
    new tekst[128], string[128], id;
    new Float:x, Float:y, Float:z;
    if(PlayerInfo[playerid][pAdmin] < 1)return SendClientMessage(playerid, COLOR_WHITE, "Niste ovlasteni");
    else if(sscanf(params, "s[128]", tekst))return SendClientMessage(playerid, COLOR_WHITE, "/e [Tekst]");
    GetPlayerPos(playerid, x, y, z);
    format(string, sizeof(string), "(( Admin %s: %s ))", PlayerName(playerid), tekst);
    ProxDetector(50.0, playerid, string, -1);
    return 1;
}
Reply
#7

Again, people are posting in the assumption that the OP has proprietary functions already.


Modifying the posted code...
pawn Код:
for(id=0;id<MAX_PLAYERS;id++)
    if(IsPlayerInRangeOfPoint(playerid, 50.0, x, y, z))
    {
        format(string, sizeof(string), "(( Admin %s: %s ))", PlayerName(playerid), tekst);
        SendClientMessage(id, -1, string);
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)