GTAOnline.net

San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: smackou77 le 30 Mai 2007, 19:56:48

Titre: compte a rebour
Posté par: smackou77 le 30 Mai 2007, 19:56:48
Bonjour à tous!
Alor voilà je cherche temps bien que mal le script pour samp qui est un compte à rebour qui freeze pour pouvoir faire des courses merci de me le passer si vous l'avez sa serait super sympas et a bientot dans samp!
Titre: Re : compte a rebour
Posté par: spykerc8 le 30 Mai 2007, 23:22:34
Tu peux chercher sur les forums sa:mp pour un compte à rebour...il y en a de très bien.
Pour le freeze utilise la fonction TogglePlayerControllable : http://wiki.sa-mp.com/wiki/Scripting_Functions#TogglePlayerControllable

Cya
Titre: Re : compte a rebour
Posté par: smackou77 le 31 Mai 2007, 17:34:28
Avant main();
new countdown=0;
new COUNTDOWN_TIMER;
new test;
 
N'import où

public COUNTDOWN()
{
   countdown++; // add one
   if (countdown >= 4)
   {
      countdown = 0;
      SendClientMessageToAll(COLOR_WHITE, "GO!!!!");
      KillTimer(COUNTDOWN_TIMER);
   } else {
      format(test, sizeof(test), "%i...", countdown);
      SendClientMessageToAll(COLOR_WHITE, test);
   }
}

Dans OnPlayerCommandText :

if(strcmp(cmd, "/countdown", true) == 0)
{
   countdown = 0; // reset
   COUNTDOWN_TIMER = SetTimer("COUNTDOWN", 500, true);
   return 1;
}
Mais TogglePlayerControllable(playerid, 0); je le mes où? mercii
Titre: Re : Re : compte a rebour
Posté par: spykerc8 le 31 Mai 2007, 17:50:45
Code: (c++) [Sélectionner]
//Avant main();
new countdown=0;
new COUNTDOWN_TIMER;
new test;
 
//N'import où

public COUNTDOWN()
{
countdown++; // add one
if (countdown >= 4)
{
   countdown = 0;
   SendClientMessageToAll(COLOR_WHITE, "GO!!!!");
   KillTimer(COUNTDOWN_TIMER);
} else {
format(test, sizeof(test), "%i...", countdown);
SendClientMessageToAll(COLOR_WHITE, test);
               TogglePlayerControllable(playerid, 0);
}
}

//Dans OnPlayerCommandText :

if(strcmp(cmd, "/countdown", true) == 0)
{
countdown = 0; // reset
COUNTDOWN_TIMER = SetTimer("COUNTDOWN", 500, true);
return 1;
}

Titre: Re : compte a rebour
Posté par: smackou77 le 31 Mai 2007, 18:10:26
trop bien merci
Titre: Re : compte a rebour
Posté par: smackou77 le 31 Mai 2007, 19:40:43
J'ai tester ce que tu m'avait dit alors j'ai mis :

OnPlayerCommandText()
if(strcmp(cmdtexte, "/countdown", true) == 0)
{
    countdown = 0;// reset
   COUNTDOWN_TIMER = SetTimer("COUNTDOWN", 500, true);
      return 1;
   }


public COUNTDOWN()
{
           countdown++; // add one
           if (countdown >= 4)
            {
              countdown = 0;
              SendClientMessageToAll(COLOR_BLUE, "GO!!!!");
              KillTimer(COUNTDOWN_TIMER);
      } else {
            format(test, sizeof(test), "%i...", countdown);
              SendClientMessageToAll(COLOR_BLUE, test);
         TogglePlayerControllable(playerid, 0);
         }
}

Tout a la fin en mettant avant main()
new countdown=0;
new COUNTDOWN_TIMER;
new test;

Et il m'indique 4erreur pourrait tu m'aider uen fois de plus?
mes erreurs:
C:\PROGRA~1\ROCKST~1\GTASAN~1\samp\GAMEMO~1\src\benj.pwn(532) : error 035: argument type mismatch (argument 1)
C:\PROGRA~1\ROCKST~1\GTASAN~1\samp\GAMEMO~1\src\benj.pwn(532) : error 035: argument type mismatch (argument 1)
C:\PROGRA~1\ROCKST~1\GTASAN~1\samp\GAMEMO~1\src\benj.pwn(533) : error 035: argument type mismatch (argument 2)
C:\PROGRA~1\ROCKST~1\GTASAN~1\samp\GAMEMO~1\src\benj.pwn(534) : error 017: undefined symbol "playerid"
C:\PROGRA~1\ROCKST~1\GTASAN~1\samp\GAMEMO~1\src\benj.pwn(537) : warning 203: symbol is never used: "OnPlayerCommandText"
C:\PROGRA~1\ROCKST~1\GTASAN~1\samp\GAMEMO~1\src\benj.pwn(537) : warning 203: symbol is never used: "test"
Pawn compiler 3.0.3367         Copyright (c) 1997-2005, ITB CompuPhase


4 Errors.