#1

sendclientmessage is my problem, don't know why


PHP код:
CMD:achat(playeridparams[])
{
   if(
pInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid, -1"{FF0000}[SYSTEM ERROR]: You don't have the privilege to use that command.");
   {
       new 
string[128], name[MAX_PLAYER_NAME];
       
GetPlayerName(playeridnamesizeof (name));
       
format(stringsizeof string"{FF0000}|AdminChat| {FFFFFF}:%s: {FFFF33}%s"namestring);
       
SendClientMessage(-1string);
   }
   return 
1;

Reply
#2

Hello!

Do you want to send this message to all admins or to playerid?

If you want to send to the playerid:
PHP код:
CMD:achat(playeridparams[])
{
   if(
pInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid, -1"{FF0000}[SYSTEM ERROR]: You don't have the privilege to use that command.");
   {
       new 
string[128], name[MAX_PLAYER_NAME];
       
GetPlayerName(playeridnamesizeof (name));
       
format(stringsizeof string"{FF0000}|AdminChat| {FFFFFF}:%s: {FFFF33}%s"namestring);
       
SendClientMessage(playerid,-1string);
   }
   return 
1;

- Mencent
Reply
#3

to all admins
Reply
#4

Ok. Then you have to write it like this:
PHP код:
CMD:achat(playeridparams[])
{
   if(
pInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid, -1"{FF0000}[SYSTEM ERROR]: You don't have the privilege to use that command.");
   {
       new 
string[128], name[MAX_PLAYER_NAME];
       
GetPlayerName(playeridnamesizeof (name));
       
format(stringsizeof string"{FF0000}|AdminChat| {FFFFFF}:%s: {FFFF33}%s"namestring);
       
SendMessageToAdmins(-1,string);
   }
   return 
1;
}
//at the end of the script
stock SendMessageToAdmins(color,string[])
{
    for(new 
i;i<MAX_PLAYERS;i++)
    {
        if(!
IsPlayerConnected(i) || IsPlayerNPC(i) || pInfo[i][AdminLevel] < 1)continue;
        
SendClientMessage(i,color,string);
    }
    return 
1;

- Mencent
Reply
#5

Lol what!!!
PHP код:
CMD:achat(playeridparams[]) 

   if(
pInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid, -1"{FF0000}[SYSTEM ERROR]: You don't have the privilege to use that command."); 
   { 
       new 
string[128], name[MAX_PLAYER_NAME]; 
       
GetPlayerName(playeridnamesizeof (name)); 
       
format(stringsizeof string"{FF0000}|AdminChat| {FFFFFF}:%s: {FFFF33}%s"namestring); 
       
SendMessageToAdmins(-1,string); 
   } 
   return 
1

//at the end of the script 
stock SendMessageToAdmins(color,string[]) 

    for(new 
i;i<MAX_PLAYERS;i++) 
    { 
        if(!
IsPlayerConnected(i) || IsPlayerNPC(i) || pInfo[i][AdminLevel] < 1)continue; 
        
SendClientMessage(i,color,string); 
    } 
    return 
1

How you use { after "if(PlayerInfo[playerid][AdminLevel] < 1) return SendClientMessage...."
Lol now everyone will see it
So use this codes:
PHP код:
CMD:achat(playeridparams[]) 

      if(
pInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid, -1"{FF0000}[SYSTEM ERROR]: You don't        have the privilege to use that command."); 
       new 
string[128], name[MAX_PLAYER_NAME],Text[100];
       
GetPlayerName(playeridnamesizeof (name)); 
       
format(stringsizeof string"{FF0000}|AdminChat| {FFFFFF}:%s: {FFFF33}%s"nameText);
       for(new 
i,i<MAX_PLAYERS,i++)
        {
         if(
pInfo[i][AdminLevel] >= || IsPlayerAdmin(i)) return SendClientMessage(i,-1,string);
        }
   } 
   return 
1

Reply
#6

If you don't know everything about PAWN then you shouldn't talk bullshit.

My code is perfectly alright.

- Mencent
Reply
#7

Quote:
Originally Posted by Mencent
Посмотреть сообщение
If you don't know everything about PAWN then you shouldn't talk bullshit.

My code is perfectly alright.

- Mencent
Yeah, your code worked for me. thanks dude. you helped me also in other situations so ima give you rep you deserve it
Reply
#8

Quote:
Originally Posted by Glossy42O
Посмотреть сообщение
you helped me also in other situations so ima give you rep you deserve it
Thank you!


- Mencent
Reply
#9

Quote:
Originally Posted by Mencent
Посмотреть сообщение
If you don't know everything about PAWN then you shouldn't talk bullshit.

My code is perfectly alright.

- Mencent
U noob m8
How u use { and } after it,they will do nothing,u can add else before { or remove both,they will don't do anything!!
Reply
#10

error line:
Код:
SendClientMessage(-1, string);
Код:
CMD:achat(playerid, params[]) 
{ 
   if(pInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid, -1, "{FF0000}[SYSTEM ERROR]: You don't have the privilege to use that command."); 
   { 
       new string[128], name[MAX_PLAYER_NAME]; 
       GetPlayerName(playerid, name, sizeof (name)); 
       format(string, sizeof string, "{FF0000}|AdminChat| {FFFFFF}:%s: {FFFF33}%s", name, string); 
       SendClientMessage(playerid,-1, string); 
   } 
   return 1; 
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)