Message to admin - 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: Message to admin (
/showthread.php?tid=571710)
Message to admin -
lanix - 21.04.2015
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);
Re: Message to admin -
Fel486 - 21.04.2015
PHP Code:
for(new a = 0; a < MAX_PLAYERS; a++)
{
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);
}
}
Re: Message to admin -
lanix - 21.04.2015
Quote:
Originally Posted by Fel486
PHP Code:
for(new a = 0; a < MAX_PLAYERS; a++)
{
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
Re: Message to admin -
R0 - 21.04.2015
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);
}
}
Re: Message to admin -
Konstantinos - 21.04.2015
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!
Re: Message to admin -
zeax - 21.04.2015
You're formatting the string AFTER sending the message.
Re: Message to admin -
lanix - 21.04.2015
not work
Re: Message to admin -
Fel486 - 21.04.2015
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.
Re: Message to admin -
lanix - 21.04.2015
Thanks guys solved.