SA-MP Forums Archive
help me with this cmd - 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: help me with this cmd (/showthread.php?tid=640789)



help me with this cmd - GoldenMan - 07.09.2017

i created this /me command
PHP код:
CMD:me(playerid, params[])
{
    new 
tmp[256], playername[25];
    if (
sscanf(params, "s[128]", tmp)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /me [message]");
    
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
    for (new 
i = 0; i < PLAYERS; i++)
    {
        if(
dini_Int(AddDirFile(dir_userfiles, playername), "RPName")==0)
        {
            if (
IsPlayerConnected2(i) && PlayerIgnored[i][playerid] == 0) SendPlayerFormattedText(i, COLOR_GREEN, "%s %s", playername, tmp);
        }
        else
        {
            if (
IsPlayerConnected2(i) && PlayerIgnored[i][playerid] == 0) SendPlayerFormattedText(i, COLOR_GREEN, "%s %s", dini_Get(AddDirFile(dir_userfiles, playername), "RolePName"), tmp);
        }
    }
    
printf("[me] %s (Id%d) %s", playername, playerid, tmp);
    return 
1;
} 
i want to add anti advert in this cmd if anyone type * GoldenMan server ip he get kicked

advanced thnx


Re: help me with this cmd - GoldenMan - 07.09.2017

pls help me


Re: help me with this cmd - n00blek - 07.09.2017

Try this and tel me if it works

PHP код:
CMD:me(playerid, params[]) 
{ 
    new 
tmp[256], playername[25]; 
    if (
sscanf(params, "s[128]", tmp)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /me [message]"); 
    
GetPlayerName(playerid, playername, MAX_PLAYER_NAME); 
    for (new 
i = 0; i < PLAYERS; i++) 
    { 
        if(
dini_Int(AddDirFile(dir_userfiles, playername), "RPName")==0) 
        { 
            if (
IsPlayerConnected2(i) && PlayerIgnored[i][playerid] == 0) SendPlayerFormattedText(i, COLOR_GREEN, "%s %s", playername, tmp); 
        } 
        else 
        { 
            if (
IsPlayerConnected2(i) && PlayerIgnored[i][playerid] == 0) SendPlayerFormattedText(i, COLOR_GREEN, "%s %s", dini_Get(AddDirFile(dir_userfiles, playername), "RolePName"), tmp); 
        } 
    } 
    
printf("[me] %s (Id%d) %s", playername, playerid, tmp); 
    return 
1; 
} 
public 
OnPlayerText(playerid, text[])
{
    if(
IsAdvertisement(text))
    {
        
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}[ERROR]: {FFFFFF}Your message contains an IP Address (strict detection).");
        return 
0;
    }
    return 
1;
} 



Re: help me with this cmd - Meller - 07.09.2017

Quote:
Originally Posted by n00blek
Посмотреть сообщение
Try this and tel me if it works

PHP код:
CMD:me(playerid, params[]) 
{ 
    new 
tmp[256], playername[25]; 
    if (
sscanf(params, "s[128]", tmp)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /me [message]"); 
    
GetPlayerName(playerid, playername, MAX_PLAYER_NAME); 
    for (new 
i = 0; i < PLAYERS; i++) 
    { 
        if(
dini_Int(AddDirFile(dir_userfiles, playername), "RPName")==0) 
        { 
            if (
IsPlayerConnected2(i) && PlayerIgnored[i][playerid] == 0) SendPlayerFormattedText(i, COLOR_GREEN, "%s %s", playername, tmp); 
        } 
        else 
        { 
            if (
IsPlayerConnected2(i) && PlayerIgnored[i][playerid] == 0) SendPlayerFormattedText(i, COLOR_GREEN, "%s %s", dini_Get(AddDirFile(dir_userfiles, playername), "RolePName"), tmp); 
        } 
    } 
    
printf("[me] %s (Id%d) %s", playername, playerid, tmp); 
    return 
1; 
} 
public 
OnPlayerText(playerid, text[])
{
    if(
IsAdvertisement(text))
    {
        
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}[ERROR]: {FFFFFF}Your message contains an IP Address (strict detection).");
        return 
0;
    }
    return 
1;
} 
tell me 1 reason this wouldn't return unknown native IsAdvertisement?