Number of arguments does not match definition -
PawelQ - 29.05.2014
Hey, i got a problem and i dont know what is wrong
Код:
ToAdminLevel(playerid,level)
{
if(IsPlayerConnected(playerid) && PlayerInfo[playerid][pAdmin]>= level && level <=6)
{
return 1;
}
return 0;
}
Error :
Код HTML:
warning 202: number of arguments does not match definition
Re: Number of arguments does not match definition -
Konstantinos - 29.05.2014
Where do you use ToAdminLevel? That's where the problem with the arguments is.
Re: Number of arguments does not match definition -
PawelQ - 29.05.2014
I used it here, to send messages to admins
Код:
stock SendMessageToRAdmins(color,const msg[])
{
for (new i=0; i<MAX_PLAYERS; i++)
{
if(!ToAdminLevel(i)) SendClientMessage(i,color,msg);
}
}
Re: Number of arguments does not match definition -
Parallex - 29.05.2014
Can you tell us the line which you are getting error on?
Re: Number of arguments does not match definition -
Konstantinos - 29.05.2014
You need to specify the level too. By the way, why do you check if it returns 0? You want to do it for non-admins?
Re: Number of arguments does not match definition -
PawelQ - 29.05.2014
That's full part of code
Код:
public OnPlayerCheat(playerid, cheatid, source[])
{
new elc_str[120],elc_reason[60],elc_name[MAX_PLAYER_NAME];
GetPlayerName(playerid, elc_name, sizeof(elc_name));
format(elc_str,sizeof(elc_str),"( ! ) %s has been punished: ",elc_name);
switch(cheatid)
{
case 1: format(elc_reason,sizeof(elc_reason),"Money Cheat ( %s $ )",source);
case 2: format(elc_reason,sizeof(elc_reason),"Banned For Weapon Cheat ( %s )",source);
case 3: format(elc_reason,sizeof(elc_reason),"Ammo Cheat ( %s Bullets )",source);
case 4: format(elc_reason,sizeof(elc_reason),"Ammo Block Cheat");
case 5: format(elc_reason,sizeof(elc_reason),"Speed Cheat");
case 6: format(elc_reason,sizeof(elc_reason),"Airbreak/Teleport Cheat");
case 7: format(elc_reason,sizeof(elc_reason),"Health Cheat");
case 8: format(elc_reason,sizeof(elc_reason),"Armour Cheat");
case 9: format(elc_reason,sizeof(elc_reason),"Vehicle Spawn Cheat");
case 10: format(elc_reason,sizeof(elc_reason),"Vehicle Crasher");
}
strcat(elc_str,elc_reason);
SendMessageToRAdmins(0xBD0000FF,elc_str);
return 1;
}
#endif
/*----------------------------------------------------------------------------*/
stock SendMessageToRAdmins(color,const msg[])
{
for (new i=0; i<MAX_PLAYERS; i++)
{
if(!ToAdminLevel(i)) SendClientMessage(i,color,msg);
}
}
/*----------------------------------------------------------------------------*/
enum pInfo
{
pAdmin,//admin level
//
};
///////////
new PlayerInfo[Max_Players][pInfo];
//
ToAdminLevel(playerid,level)
{
if(IsPlayerConnected(playerid) && PlayerInfo[playerid][pAdmin]>= level && level <=6)
{
return 1;
}
return 0;
}
Re: Number of arguments does not match definition -
[NWA]Hannes - 29.05.2014
Judging from this
pawn Код:
ToAdminLevel(playerid, level)
I assume that the function has two parameters, playerid and level.
Therefore you should change your row under SendMessageToRAdmins to this
pawn Код:
if(ToAdminLevel(i, 1)) SendClientMessage(i,color,msg);
Assuming you want to send the message to administrators over level 1 of course.
Re: Number of arguments does not match definition -
PawelQ - 29.05.2014
Thanks a lot!
Problem solved.
Re: Number of arguments does not match definition -
[NWA]Hannes - 29.05.2014
You need to put in the minimum level of the administrator based on your ToAdminLevel function.
If you want to send the message to level 1 administrators up to level 6 you would put ToAdminLevel(i, 1), if you only want to send it for level 5 and level 6 administrators you would put ToAdminLevel(i, 5) etc.
Use this
pawn Код:
stock SendMessageToRAdmins(color, const msg[])
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(ToAdminLevel(i, 1)) SendClientMessage(i, color, msg);
}
}
//////////////////
stock ToAdminLevel(playerid, level)
{
if(PlayerInfo[playerid][pAdmin] >= level && level <= 6) return 1;
return 0;
}