Exercice en Pawn - Dйbutant
#11

TheWWorld;3435308 Wrote:
PHP Code:
COMMAND:salut(playeridparams[])
{
    new 
string[255], nomenvoyeur[21], nomrecepteur[21];
    
GetPlayerName(playeridnomenvoyeursizeof(nomenvoyeur));
    for(new 
0&ltMAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
        
GetPlayerName(inomrecepteursizeof(nomrecepteur));
        
format(stringsizeof(string), "Salut %s ! Je suis %s"nomrecepteurnomenvoyeur);
        
SendClientMessage(i0xFF0000FF,string);
        return 
1;
        }
    }
    return 
1;


Voilа, j'ai un peut optimiser, le code faisait 35lignes :p

Ta version est moins optimisйe que celle de Baltimore.
Sachant que SCM ne peut avoir que 144 caractиres et si on prend en compte le nullbyte, le mieux est donc de dйclarer ton tableau а 145 et il a utilisй foreach pour que зa soit plus rapide.

De plus, ta version enverra un message au joueur ayant tapй la commande, or S4t3k l'a dit :
Quote:а chaque joueur connectй [COLOR="Red"]sauf йvidement le joueur qui aura tapй la commande[/COLOR].

Edit : Et ta boucle s'arrкtera au premier joueur connectй, car tu as un return dans ta boucle.
Reply


Messages In This Thread
Exercice en Pawn - Dйbutant - by Dutheil - 16.04.2015, 20:38
Re : Exercice en Pawn - Dйbutant - by Dutheil - 16.04.2015, 23:53
Re : Exercice en Pawn - Dйbutant - by Smocky - 17.04.2015, 15:12
Re : Exercice en Pawn - Dйbutant - by Chipardeur - 17.04.2015, 16:14
Re : Exercice en Pawn - Dйbutant - by Dutheil - 17.04.2015, 16:36
Re : Exercice en Pawn - Dйbutant - by Chipardeur - 18.04.2015, 08:45
Re : Exercice en Pawn - Dйbutant - by S4t3K - 19.04.2015, 11:53
Re: Exercice en Pawn - Dйbutant - by Baltimore - 19.04.2015, 12:04
Re : Exercice en Pawn - Dйbutant - by TheWWorld - 19.04.2015, 12:15
Re : Exercice en Pawn - Dйbutant - by S4t3K - 19.04.2015, 12:19
Re : Exercice en Pawn - Dйbutant - by Dutheil - 19.04.2015, 12:19
Re : Exercice en Pawn - Dйbutant - by TheWWorld - 19.04.2015, 12:28
Re : Exercice en Pawn - Dйbutant - by S4t3K - 19.04.2015, 15:15
Re : Exercice en Pawn - Dйbutant - by MrAlexisX2 - 19.04.2015, 15:24
Re : Exercice en Pawn - Dйbutant - by S4t3K - 19.04.2015, 15:55
Re : Exercice en Pawn - Dйbutant - by MrAlexisX2 - 19.04.2015, 16:16
Re: Exercice en Pawn - Dйbutant - by Adawg - 19.04.2015, 18:52
Re: Exercice en Pawn - Dйbutant - by Maximun - 19.04.2015, 19:14
Re : Exercice en Pawn - Dйbutant - by StreetRP - 19.04.2015, 20:54
Re : Re: Exercice en Pawn - Dйbutant - by Buthers - 19.04.2015, 21:10
Re : Exercice en Pawn - Dйbutant - by Z3N0N - 19.04.2015, 21:45
Re : Exercice en Pawn - Dйbutant - by Skinnz - 24.04.2015, 14:06
Re : Exercice en Pawn - Dйbutant - by BreakStore - 02.05.2015, 14:28
Re : Exercice en Pawn - Dйbutant - by LordFalcon - 02.05.2015, 22:37
Re : Exercice en Pawn - Dйbutant - by Dutheil - 02.05.2015, 22:47
Re : Exercice en Pawn - Dйbutant - by Sus-Pets - 02.05.2015, 22:49
Re : Exercice en Pawn - Dйbutant - by BreakStore - 02.05.2015, 22:53
Re : Exercice en Pawn - Dйbutant - by Dutheil - 02.05.2015, 22:55
Re: Exercice en Pawn - Dйbutant - by d0wze - 03.05.2015, 04:58
Re : Exercice en Pawn - Dйbutant - by Dutheil - 03.05.2015, 08:23
Re : Re: Exercice en Pawn - Dйbutant - by Dutheil - 05.11.2015, 18:38
Re: Exercice en Pawn - Dйbutant - by Jabern - 05.11.2015, 18:39
Re : Exercice en Pawn - Dйbutant - by Buthers - 05.11.2015, 18:47
Re : Exercice en Pawn - Dйbutant - by Dutheil - 05.11.2015, 19:03
Re: Exercice en Pawn - Dйbutant - by Jabern - 05.11.2015, 19:03
Re : Exercice en Pawn - Dйbutant - by S4t3K - 06.11.2015, 10:27
Re : Exercice en Pawn - Dйbutant - by S4t3K - 08.11.2015, 15:05

Forum Jump:


Users browsing this thread: 1 Guest(s)