Message to admin
#1

I have little problem i made anti health hack, and when player hack I want only admin gets the message that the player is possible Health Hacker
Code:Something with this is wrong does not show up in the game and all the players get this message
Code:
new pname[MAX_PLAYER_NAME];
            new string[256];
            GetPlayerName(target,pname,sizeof(pname));
            SendClientMessage(admin,0xFF0000FF,string);//string
            format(string,sizeof(string),"%s is possible Health Hacker!",pname);
Reply
#2

PHP Code:

for(new 0MAX_PLAYERSa++)
{
    if(
IsPlayerConnected(a) && IsPlayerAdmin(a))
    {
        new 
pname[MAX_PLAYER_NAME];
        new 
string[256];
        
GetPlayerName(target,pname,sizeof(pname));
        
SendClientMessage(a,0xFF0000FF,string);//string
        
format(string,sizeof(string),"%s is possible Health Hacker!",pname);
    }
    

Reply
#3

Quote:
Originally Posted by Fel486
View Post
PHP Code:

for(new 0MAX_PLAYERSa++)
{
    if(
IsPlayerConnected(a) && IsPlayerAdmin(a))
    {
        new 
pname[MAX_PLAYER_NAME];
        new 
string[256];
        
GetPlayerName(target,pname,sizeof(pname));
        
SendClientMessage(a,0xFF0000FF,string);//string
        
format(string,sizeof(string),"%s is possible Health Hacker!",pname);
    }
    

yes, but does not show text, only chat moves
Reply
#4

pawn Code:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if( pInfo[i][put here the admin thingy in your script])
    {
        new pname[MAX_PLAYER_NAME];
        new string[48];
        GetPlayerName(target,pname,sizeof(pname));
        format(string,sizeof(string),"%s is possible Health Hacker!",pname);
        SendClientMessage(i,-1,string);
}
   
}
Reply
#5

He sent the empty string first and then he formatted the text. Also would be better to declare the variables outside of the loop and using foreach for looping through players because it loops through connected players ONLY!
Reply
#6

You're formatting the string AFTER sending the message.
Reply
#7

not work
Reply
#8

I didn't pay attetion, I copied your example.

They said what was the error... But although, you must be logged as RCON admin to work.
Reply
#9

Thanks guys solved.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)