SA-MP Forums Archive
achat - 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: achat (/showthread.php?tid=583035)



achat - Glossy42O - 25.07.2015

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;




AW: achat - Mencent - 25.07.2015

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


Re: achat - Glossy42O - 25.07.2015

to all admins


AW: achat - Mencent - 25.07.2015

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


Re: achat - Roberto80 - 25.07.2015

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




AW: achat - Mencent - 25.07.2015

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

My code is perfectly alright.

- Mencent


Re: AW: achat - Glossy42O - 25.07.2015

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


AW: achat - Mencent - 25.07.2015

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


- Mencent


Re: AW: achat - Roberto80 - 25.07.2015

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!!


Re: achat - TenTen - 25.07.2015

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; 
}