SA-MP Forums Archive
Command: Message on radius - 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)
+--- Thread: Command: Message on radius (/showthread.php?tid=402304)



Command: Message on radius - FL3GM4 - 26.12.2012

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;
}



Re: Command: Message on radius - Deduction - 26.12.2012

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;
}



Re: Command: Message on radius - FL3GM4 - 26.12.2012

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.



Re: Command: Message on radius - Deduction - 26.12.2012

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);
        }
    }
}



Re: Command: Message on radius - FL3GM4 - 26.12.2012

Код:
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);
        }
    }
}



Re: Command: Message on radius - Deduction - 26.12.2012

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;
}



Re: Command: Message on radius - Joe Staff - 26.12.2012

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);
    }