OnPlayerClickMap
#1

Hello i have this code, but i have a problem; when some player "click map" sends me alerts of everyone.

PHP код:
public OnPlayerClickMap(playeridFloat:fXFloat:fYFloat:fZ)
{
    foreach (
Playeri)
    if(
PlayerInfo[playerid][pAdmin] >= 1)
    {
        return 
1;
    }
    else
    {
        new 
string[128];
        new 
sendername[MAX_PLAYERS];
        
GetPlayerName(isendernamesizeof(sendername));
        
format(string256"AdmWarning:[%d][%s]Posible TP, Revisalo rapido!",isendername);
        
SendSpeedMessage(COLOR_YELLOWstring);
        
SendDebugMessage("AntiCheat");
    }
    return 
1;

And i've seen in other server that, when a player click map the point don't appears. How can i do that?
Reply
#2

You Don't need to loop players!

Remove foreach()… from your code

And use "playerid"

For exampe:
Instead of: "GetPlayerName(i,…" >> "GetPlayerName(playerid, … "
Reply
#3

Quote:
Originally Posted by CoR3
Посмотреть сообщение
Hello i have this code, but i have a problem; when some player "click map" sends me alerts of everyone.

PHP код:
public OnPlayerClickMap(playeridFloat:fXFloat:fYFloat:fZ)
{
    foreach (
Playeri)
    if(
PlayerInfo[playerid][pAdmin] >= 1)
    {
        return 
1;
    }
    else
    {
        new 
string[128];
        new 
sendername[MAX_PLAYERS];
        
GetPlayerName(isendernamesizeof(sendername));
        
format(string256"AdmWarning:[%d][%s]Posible TP, Revisalo rapido!",isendername);
        
SendSpeedMessage(COLOR_YELLOWstring);
        
SendDebugMessage("AntiCheat");
    }
    return 
1;

And i've seen in other server that, when a player click map the point don't appears. How can i do that?
If this is what you mean, its actually a code when a player not greater that admin level 1 clicks that map, a message will go to all admins of level 1 and higher.
pawn Код:
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        return 1;
    }
    else
    {
        new string[128];
        new sendername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "AdmWarning:[%d][%s]Posible TP, Revisalo rapido!",i, sendername);
        foreach (Player, i)
        {
            if(PlayerInfo[playerid][pAdmin] >= 1)
            {
                SendClientMessage(i, COLOR_YELLOW, string);
                SendDebugMessage("AntiCheat");
            }
        }
    }
    return 1;
}
NOTE: i have used SendClientMessage(i, COLOR_YELLOW, string); because you haven't provided the code for SendSpeedMessage, or anything related to it!

Also, you had the wrong string size entered in the format part!

For the pointer not to appear, simply return 0; in the callback!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)