GTAOnline.net
San Andreas Multiplayer (sa:mp) => Problèmes et bugs => Discussion démarrée par: D3nko le 11 Septembre 2009, 11:45:14
-
Bonjour, j'ai besoin d'aide sur un bout de script et le problème étant que je ne sais pas comment envoyer un message à tous les joueurs, j'ai essayé le "i" et voila l'erreur.
{
new plname[MAX_PLAYER_NAME];
new i[256]
new astring[256];
GetPlayerName(playerid, plname, sizeof(plname));
format(astring, sizeof(astring), "%s a rejoint le serveur.",plname);
SendClientMessage(i, COLOR_RED, astring);
if(Security != 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "Regles NON RESPECTEES, KICK !");
Kick(playerid);
format(astring, sizeof(astring), "%s a quitté le serveur (Kické).",plname);
SendClientMessage(i, COLOR_RED, astring);
return 1;
}
new namestring = strfind(plname, "_", true);
if(namestring == -1)
{
SendClientMessage(playerid, COLOR_YELLOW2, "Immigration Department: Votre nom est incorrect.");
SendClientMessage(playerid, COLOR_YELLOW2, "Votre nom doit être au format Prénom_Nom. Ex. John_Smith");
Kick(playerid);
format(astring, sizeof(astring), "%s a quitté le serveur (Kické).",plname);
SendClientMessage(i, COLOR_RED, astring);
return 1;
}
Erreur :
C:\Documents and Settings\Administrateur\Bureau\MINEARP SERV 0.3x\gamemodes\warp.pwn(2876) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Administrateur\Bureau\MINEARP SERV 0.3x\gamemodes\warp.pwn(2882) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Administrateur\Bureau\MINEARP SERV 0.3x\gamemodes\warp.pwn(2892) : error 035: argument type mismatch (argument 1)
-
Dans ton script, la variable i est un tableau.
La fonction SendClientMessage veut une valeur comme premier paramètre.
Donc quand tu fais :
new i[256];
SendClientMessage (i, COLOR_RED, astring);Le compilateur te dit que l'argument 1 n'est pas du bon type.
Pour faire ce que tu veux faire, il faut faire une boucle :
new plname[MAX_PLAYER_NAME];
new i;
new astring[256];
GetPlayerName (playerid, plname, sizeof(plname));
format (astring, sizeof(astring), "%s a rejoint le serveur.",plname);
for (i=0 ; i<MAX_PLAYERS)
{
if (IsPlayerConnected (i))
{
SendClientMessage (i, COLOR_RED, astring);
}
}
Sinon, tu peux utiliser SendClientMessageToAll :
GetPlayerName (playerid, plname, sizeof(plname));
format (astring, sizeof(astring), "%s a rejoint le serveur.",plname);
SendClientMessageToAll (COLOR_RED, astring);
++
Syg
-
Merci, ça marche.
Euh au fait j'ai un warning qui traine depuis longtemps.
warning 203: symbol is never used: "vehicleEntered"
-
Merci, ça marche.
Euh au fait j'ai un warning qui traine depuis longtemps.
warning 203: symbol is never used: "vehicleEntered"
Déjà tu est dans la mauvais section mais bon c' est pas grave.
pour le warning enleve le new vehicleEntered;
-
Ah désolé, bon alors je m'arrête ici mais juste une dernière question je remplace le "new vehicleEntered;" par quoi c'était plutot ça ma question car j'ai compris qu'il fallait l'enlever mais je sais pas par quoi le remplace-t-on.
-
Béh tu l' efface et puis c' est tout