GTAOnline.net

San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: Leonidas300 le 20 Août 2010, 23:48:18

Titre: Result qui marche pas
Posté par: Leonidas300 le 20 Août 2010, 23:48:18
Salut
Voila, j'aimerais que le joueur puisse voir le message qu'il a envoyé, donc voila le code de mon Report-Menu :

Code: (pawn) [Sélectionner]
if(dialogid == REPORTMENU)
{
if(response)
        {
        new str[160];
        new result[64];
    GetPlayerName(playerid, str, MAX_PLAYER_NAME);
            for (new i = 0; i < MAX_PLAYER_NAME; i++)
            if (str[i] == '_')
            str[i] = ' ';
format(str, sizeof(str), "(ID:%d)%s Report: %s",playerid, str, (inputtext));
ABroadCast(COLOR_YELLOW,str,1);
SendClientMessage(playerid, COLOR_YELLOW, "Report: %s", (result));

}
}
Titre: Re : Result qui marche pas
Posté par: Brian Turner le 20 Août 2010, 23:55:44
Salut
Voila, j'aimerais que le joueur puisse voir le message qu'il a envoyé, donc voila le code de mon Report-Menu :

Code: (pawn) [Sélectionner]
if(dialogid == REPORTMENU)
{
if(response)
        {
        new str[160];
        new result[64];
    GetPlayerName(playerid, str, MAX_PLAYER_NAME);
            for (new i = 0; i < MAX_PLAYER_NAME; i++)
            if (str[i] == '_')
            str[i] = ' ';
format(str, sizeof(str), "(ID:%d)%s Report: %s",playerid, str, (inputtext));
ABroadCast(COLOR_YELLOW,str,1);
SendClientMessage(playerid, COLOR_YELLOW, "Report: %s", (result));

}
}

Perso je croix que ta pas vraiment cherché... c'est tout bete :
Code: (pawn) [Sélectionner]
SendClientMessage(playerid, COLOR_YELLOW, "Report: %s", (inputtext));
Titre: Re : Result qui marche pas
Posté par: scott1 le 21 Août 2010, 00:29:33
Tu définis une string mais tu n'insère rien dedans ( result ) alors au moment de l'envoi ben il n'y a rien a envoyer.
Titre: Re : Result qui marche pas
Posté par: Leonidas300 le 21 Août 2010, 11:49:00
Merci mais sa me fait deux warning
Code: (pawn) [Sélectionner]
C:DOCUME~1MamanMESDOC~1\_FR_LO~1GAMEMO~1LS-RP-V2.PWN(3868) : warning 202: number of arguments does not match definition
Code: (pawn) [Sélectionner]
if(dialogid == REPORTMENU)
{
if(response)
        {
        new str[160];
    GetPlayerName(playerid, str, MAX_PLAYER_NAME);
            for (new i = 0; i < MAX_PLAYER_NAME; i++)
            if (str[i] == '_')
            str[i] = ' ';
format(str, sizeof(str), "(ID:%d)%s Report: %s",playerid, str, (inputtext));
ABroadCast(COLOR_YELLOW,str,1);
SendClientMessage(playerid, COLOR_YELLOW, "Report Envoyé!");
SendClientMessage(playerid, COLOR_YELLOW, "Report: %s", (inputtext));

}
}
if(dialogid == QUESTIONSMENU)
{
    if(response)
        {
        new str[160];
    GetPlayerName(playerid, str, MAX_PLAYER_NAME);
            for (new i = 0; i < MAX_PLAYER_NAME; i++)
            if (str[i] == '_')
            str[i] = ' ';
format(str, sizeof(str), "(ID:%d)%s Question: %s",playerid, str, (inputtext));
ABroadCast(COLOR_YELLOW,str,1);
SendClientMessage(playerid, COLOR_YELLOW, "Question: %s", (inputtext));

}
}

Double post
Edit : sa me fait crash le serveur IG qunad j'envoie un msg dans le menu report ou question

Double post
Edit: J'ai fait un Format, je vais voir si sa marche, en tout cas les warning sont partis
Titre: Re : Result qui marche pas
Posté par: Lychaos le 21 Août 2010, 11:54:27
SendClientMessage(playerid, COLOR_YELLOW, "Report: %s", (inputtext));

on ne met pas de %s dans un Send Client Message

Faut le faire via un format

ex:
format(str, sizeof(str), " Report: %s", (inputtext));
SendClientMessage(playerid, COLOR_YELLOW, "Report: %s", (inputtext));
Titre: Re : Result qui marche pas
Posté par: Leonidas300 le 21 Août 2010, 11:57:20
J'ai edit pour dire que j'avais fait un format et regler le problème, mais merci à tous quand même, j'y suis arriver, en mettant un Format:

Code: (pawn) [Sélectionner]
format(string, sizeof(string), "Report: %s", (inputtext));
SendClientMessage(playerid, COLOR_YELLOW, string);

Fin du sujet x)