SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 26/05/2019, 04:37 PM   #1
Jaua10
Huge Clucker
 
Join Date: Apr 2011
Posts: 310
Reputation: 13
Default admin chat

Guys i'm new coding and i try to do an adminchat but show me this warning:

Code:
C:\Users\Solmileidis Garcia\Desktop\Jesus\Clean Server\gamemodes\GTASARPG.pwn(1241) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase

Header size:           5420 bytes
Code size:           150832 bytes
Data size:            87204 bytes
Stack/heap size:      16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements:  259840 bytes

1 Warning.
and this is my code? whats the problem here? when i try to use the cmd in games, says Unknow Command

PHP Code:
CMD:a(playeridparams[]) return cmd_adminchat(playeridparams);
CMD:adminchat(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] < 1) return SendMessage(playeridCOLOR_WHITENOADMINNOADMIN2);
    if(
isnull(params)) return SendMessage(playerid, -1"USAGE: {0092FF}(/a)dminchat [Admin Chat]",
                                                         
"USO: {0092FF}(/a)dminchat [Chat Admin]");
    if(
strlen(params) < || strlen(params) > 128) return SendMessage(playeridCOLOR_CORRECTION"The text is invalid, it must be between 1 and 128""El texto es inválido, debe ser entre 1 y 128");
    
//
    
new text[128];
    
format(textsizeof(text), "%s %s: %s",GetAdminRank(playerid), GetName(playerid), params);
    
SendMessage(-1COLOR_ADMINCHATtexttexttrue);
    return 
1;

Jaua10 is offline   Reply With Quote
Old 26/05/2019, 05:08 PM   #2
Plastikmensch
Huge Clucker
 
Join Date: Aug 2016
Posts: 272
Reputation: 22
Default Re: admin chat

You give one of your functions more (or less) arguments than it expects. It tells you.
My guess, it's the SendMessage function. Please show us how you defined it.

Also, if you use Pawn.CMD you can use the alias tag:
Code:
CMD:adminchat(playerid,params[])
{
   //DoStuff
}
alias:adminchat("a"); //When player types /a or /adminchat command gets executed.
//You can set multiple aliases like this:
alias:adminchat("a","achat","ac");
Plastikmensch is offline   Reply With Quote
Old 26/05/2019, 05:21 PM   #3
Jaua10
Huge Clucker
 
Join Date: Apr 2011
Posts: 310
Reputation: 13
Default Re: admin chat

I dont have send message funtion
Jaua10 is offline   Reply With Quote
Old 26/05/2019, 05:25 PM   #4
OtimoJogo
Big Clucker
 
Join Date: Jul 2016
Posts: 158
Reputation: 2
Default Re: admin chat

You can post your SendMessage method??
OtimoJogo is offline   Reply With Quote
Old 26/05/2019, 05:27 PM   #5
Jaua10
Huge Clucker
 
Join Date: Apr 2011
Posts: 310
Reputation: 13
Default Re: admin chat

I dont have it..i think...i use sendmessage for two languages
Jaua10 is offline   Reply With Quote
Old 26/05/2019, 07:25 PM   #6
TheToretto
Gangsta
 
TheToretto's Avatar
 
Join Date: Jul 2015
Posts: 586
Reputation: 66
Default Re: admin chat

Assuming that your two languages function accepts 4 arguments (previous usage, no warnings) then you should remove the last value "true" which has nothing to do in there.

Code:
SendMessage(-1, COLOR_ADMINCHAT, text, text, true);
becomes
Code:
SendMessage(-1, COLOR_ADMINCHAT, text, text);
__________________






Toretto#9902

Rest in peace grandpa, 03 November 2018
TheToretto is offline   Reply With Quote
Old 26/05/2019, 07:37 PM   #7
Jaua10
Huge Clucker
 
Join Date: Apr 2011
Posts: 310
Reputation: 13
Default Re: admin chat

Quote:
Originally Posted by TheToretto View Post
Assuming that your two languages function accepts 4 arguments (previous usage, no warnings) then you should remove the last value "true" which has nothing to do in there.

Code:
SendMessage(-1, COLOR_ADMINCHAT, text, text, true);
becomes
Code:
SendMessage(-1, COLOR_ADMINCHAT, text, text);
i see...now dont show mre the warning but IG when i type " /a hello " shows me nothing, did u know why?
Jaua10 is offline   Reply With Quote
Old 26/05/2019, 10:06 PM   #8
SiaReyes
Huge Clucker
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 414
Reputation: 28
Default Re: admin chat

Quote:
Originally Posted by Jaua10 View Post
i see...now dont show mre the warning but IG when i type " /a hello " shows me nothing, did u know why?
I think that true is to enable admin chat or maybe not. Refer other 'SendMessage' codes!
SiaReyes is offline   Reply With Quote
Old 26/05/2019, 11:53 PM   #9
TheToretto
Gangsta
 
TheToretto's Avatar
 
Join Date: Jul 2015
Posts: 586
Reputation: 66
Default Re: admin chat

Quote:
Originally Posted by SiaReyes View Post
I think that true is to enable admin chat or maybe not. Refer other 'SendMessage' codes!
No it's not, even without seeing the function, as the command itself is pretty much fucked up and does nothing.

Quote:
Originally Posted by Jaua10 View Post
i see...now dont show mre the warning but IG when i type " /a hello " shows me nothing, did u know why?
You are sending the message the player ID "-1", so it's normal that you aren't getting anything as an output, loop throught connected admins, then send them the message.

Code:
CMD:adminchat(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 1) return SendMessage(playerid, COLOR_WHITE, NOADMIN, NOADMIN2); 
    if(isnull(params)) return SendMessage(playerid, -1, "USAGE: {0092FF}(/a)dminchat [Admin Chat]", "USO: {0092FF}(/a)dminchat [Chat Admin]"); 
    if(strlen(params) < 1) return SendMessage(playerid, COLOR_CORRECTION, "The text is invalid, it must be at least 1 character long", "El texto es inválido, debe ser entre 1 y 128"); 
    new text[128]; 
    format(text, sizeof(text), "%s %s: %s",GetAdminRank(playerid), GetName(playerid), params); 
    for(new i; i < MAX_PLAYERS; i++){
        if(!IsPlayerConnected(i)) continue;

        if(PlayerInfo[i][pAdmin]) SendMessage(i, COLOR_ADMINCHAT, text, text);
    }
    return 1; 
}
Also, no need to check if the input is longer than 128, as it's the maximum, there's no way to go further.
__________________






Toretto#9902

Rest in peace grandpa, 03 November 2018
TheToretto is offline   Reply With Quote
Old 27/05/2019, 01:52 AM   #10
Jaua10
Huge Clucker
 
Join Date: Apr 2011
Posts: 310
Reputation: 13
Default Re: admin chat

Quote:
Originally Posted by TheToretto View Post
No it's not, even without seeing the function, as the command itself is pretty much fucked up and does nothing.



You are sending the message the player ID "-1", so it's normal that you aren't getting anything as an output, loop throught connected admins, then send them the message.

Code:
CMD:adminchat(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 1) return SendMessage(playerid, COLOR_WHITE, NOADMIN, NOADMIN2); 
    if(isnull(params)) return SendMessage(playerid, -1, "USAGE: {0092FF}(/a)dminchat [Admin Chat]", "USO: {0092FF}(/a)dminchat [Chat Admin]"); 
    if(strlen(params) < 1) return SendMessage(playerid, COLOR_CORRECTION, "The text is invalid, it must be at least 1 character long", "El texto es inválido, debe ser entre 1 y 128"); 
    new text[128]; 
    format(text, sizeof(text), "%s %s: %s",GetAdminRank(playerid), GetName(playerid), params); 
    for(new i; i < MAX_PLAYERS; i++){
        if(!IsPlayerConnected(i)) continue;

        if(PlayerInfo[i][pAdmin]) SendMessage(i, COLOR_ADMINCHAT, text, text);
    }
    return 1; 
}
Also, no need to check if the input is longer than 128, as it's the maximum, there's no way to go further.
Aiight i got it, but now i got the chat but dont sho the admin rank name and its defined in the code why is that?
Jaua10 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Ajuda] Prefixo admin no chat + chat proximo Ryuzaki07 Português/Portuguese 19 07/06/2019 05:25 PM
admin chat and advisor chat avaible without /aduty /cduty Acres Scripting Help 2 09/01/2015 02:13 PM
[Tutorial] Group Chat Without Symbols(Includes Admin Chat) Yashas Tutorials 0 04/01/2014 05:01 PM
admin chat and tester chat dont work Don_Cage Scripting Help 4 25/03/2013 05:08 PM
Admin Chat < Admins can't see chat or my text, but I can see their chat Andy_McKinley Help Archive 37 17/05/2011 09:26 PM


All times are GMT. The time now is 10:19 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.