PDA

View Full Version : Warning : 202


Eymeric69
04/05/2016, 01:19 PM
Hi everybody there is my problem

Code :
COMMAND:serviceadmin(playerid, params[])
{
// Send the command to all admins so they can see it
SendAdminText(playerid, "/serviceadmin", params);

// Exit the command if the player hasn't logged in using his password
if (APlayerData[playerid][LoggedIn] == false) return 0;
// Exit the command if the player has an admin-level lower than 1
if (APlayerData[playerid][PlayerLevel] < 1) return 0;
new AdminName[24];
GetPlayerName(playerid, AdminName, sizeof(AdminName));
SetPlayerSkin(playerid, 217);
// message admin
SendClientMessage(playerid,0xFFFFFFFF, "Vous etes passez en admin en service !");
SendClientMessageToAll(0xFFFFFFFF, "L'administrateur %s c'est mis en service", AdminName);
return 1;
}

Warning :
C:\****\****\****\Serveur SAMP\gamemodes\****.pwn(17919) : warning 202: number of arguments does not match definition

Can you help me ?

Konstantinos
04/05/2016, 01:24 PM
https://wiki.sa-mp.com/wiki/Format

You need to format a string and then use it in SendClientMessageToAll.

Nin9r
04/05/2016, 01:30 PM
Change it " SendClientMessageToAll(0xFFFFFFFF, "L'administrateur %s c'est mis en service", AdminName); " with :

new string[128];
format(string, sizeof(string),"L'administrateur %s c'est mis en service", AdminName);
SendClientMessageToAll(0xFFFFFF, string);

Eymeric69
04/05/2016, 01:41 PM
Ok it's fixed :

COMMAND:serviceadmin(playerid, params[])
{
// Send the command to all admins so they can see it
SendAdminText(playerid, "/serviceadmin", params);

// Exit the command if the player hasn't logged in using his password
if (APlayerData[playerid][LoggedIn] == false) return 0;
// Exit the command if the player has an admin-level lower than 1
if (APlayerData[playerid][PlayerLevel] < 1) return 0;
new AdminName[24];
new string[128];
GetPlayerName(playerid, AdminName, sizeof(AdminName));
format(string, sizeof(string),"L'administrateur %s c'est mis en service !", AdminName);
SendClientMessageToAll(0xFFFFFF, string);
SetPlayerSkin(playerid, 217);
// message admin
SendClientMessage(playerid,0xFFFFFFFF, "Vous etes passez en admin en service !");
return 1;
}
Thank You All