• 09 Juillet 2025, 05:16:03


Auteur Sujet: CheckPoint, Problème...  (Lu 1633 fois)

0 Membres et 1 Invité sur ce sujet

Hors ligne thomasleroi

  • *
  • Tueur
  • Messages: 70
    • Voir le profil
CheckPoint, Problème...
« le: 30 Juin 2008, 18:31:56 »
J'ai un problèle. IN-GAME, il n'y a aucun checkpoint...

En haut :
new Check1;
OnPlayerSpawn :
Check1 = SetPlayerRaceCheckpoint(playerid,0,1940.72,-1135.29,25.33,1972.7726,-1227.5735,24.8474,3.0);
Public :
public OnPlayerEnterRaceCheckpoint(playerid) {
if (Check1){
SendClientMessage(playerid,0xFFFF00AA, "> CheckPoint atteint.");
}
return 1;
}

Hors ligne Bayshore

  • *
  • Grand Banditisme
  • Messages: 923
    • Voir le profil
Re : CheckPoint, Problème...
« Réponse #1 le: 30 Juin 2008, 20:07:24 »
Je ne croit pas que SetPlayerRaceCheckpoint retourne une valeur, donc inutile d'utiliser Check1 je pense.

EDIT: J'avais raison.
~~> http://streetplaya.hopto.org/SAMP_Wiki/wiki.sa-mp.com/wiki/SetPlayerRaceCheckpoint.html


++
Alexandre
« Modifié: 30 Juin 2008, 20:13:54 par -Alexandre »

Hors ligne Nikko™

  • *
  • Mafioso
  • Messages: 2393
    • Voir le profil
Re : CheckPoint, Problème...
« Réponse #2 le: 30 Juin 2008, 20:56:44 »
sinon utilise la fonction normal des CP.

++
nikko

Hors ligne thomasleroi

  • *
  • Tueur
  • Messages: 70
    • Voir le profil
Re : CheckPoint, Problème...
« Réponse #3 le: 01 Juillet 2008, 10:19:46 »
Avec le CH normal, j'ai le même problème...

new Check1;
Check1 = SetPlayerCheckpoint(playerid,1940.72,-1135.29,25.33,3);
public OnPlayerEnterCheckpoint(playerid) {
if (Check1){
SendClientMessage(playerid,0xFFFF00AA, "> CheckPoint atteint.");
}
return 1;
}

Hors ligne Bayshore

  • *
  • Grand Banditisme
  • Messages: 923
    • Voir le profil
Re : CheckPoint, Problème...
« Réponse #4 le: 01 Juillet 2008, 13:48:56 »
Un CP normal ne renvoi pas de valeur non plus, pas la peine de définir Check1.

Et sinon ta condition ne veut rien dire.


++
Alexandre

Hors ligne thomasleroi

  • *
  • Tueur
  • Messages: 70
    • Voir le profil
Re : CheckPoint, Problème...
« Réponse #5 le: 01 Juillet 2008, 13:52:54 »
Le truck c'est que je veux faire. C'est que quand un joueur prennent le CP, il y a un Disable et sa en recreéz un autres...

Je viens de tester, sa ne marche pas non plus sans le chek1
« Modifié: 01 Juillet 2008, 14:04:27 par thomasleroi »

Hors ligne thomasleroi

  • *
  • Tueur
  • Messages: 70
    • Voir le profil
Re : CheckPoint, Problème...
« Réponse #6 le: 01 Juillet 2008, 17:22:41 »
UP (c'est bon qa me l'affiche mais j'ai un PB qui est chiant...)
Voilà :

new :
new Check1,Check2,Check3,Check4,Check5,Check6,Check7,Check8,Check9,Check10,Check11,
Check12,Check13,Check14,Check15,Check16,Check17,Check18,Check19,Check20,Check21,Check22,
Check23,Check24,Check25,Check26,Check27;

OnPlayerConnect :
Check1 = SetPlayerCheckpoint(playerid,1940.72,-1135.29,25.33,6);
public :
public OnPlayerEnterCheckpoint(playerid) {
if (Check1){
DisablePlayerCheckpoint(Check1);
Check2 = SetPlayerCheckpoint(playerid,1972.77,-1227.57,24.84,6);
if (Check2){
DisablePlayerCheckpoint(Check2);
Check3 = SetPlayerCheckpoint(playerid,2044.1636,-1261.2198,23.8203,6);
if (Check3){
DisablePlayerCheckpoint(Check3);
Check4 = SetPlayerCheckpoint(playerid,2044.1636,-1261.2198,23.8203,6);
if (Check4){
DisablePlayerCheckpoint(Check4);
Check5 = SetPlayerCheckpoint(playerid,2069.3430,-1363.0996,23.8153,6);
if (Check5){
DisablePlayerCheckpoint(Check5);
Check6 = SetPlayerCheckpoint(playerid,2112.3040,-1405.8660,23.8281,6);
if (Check6){
DisablePlayerCheckpoint(Check6);
Check7 = SetPlayerCheckpoint(playerid,2111.1165,-1690.6434,13.3828,6);
if (Check7){
DisablePlayerCheckpoint(Check7);
Check8 = SetPlayerCheckpoint(playerid,2110.7415,-1785.9918,13.3865,3);
if (Check8){
DisablePlayerCheckpoint(Check8);
Check9 = SetPlayerCheckpoint(playerid,2048.6125,-1812.2382,13.3828,6);
if (Check9){
DisablePlayerCheckpoint(Check9);
Check10 = SetPlayerCheckpoint(playerid,1952.5049,-1825.4863,13.5469,3);
if (Check10){
DisablePlayerCheckpoint(Check10);
Check11 = SetPlayerCheckpoint(playerid,1770.5269,-1826.2952,13.3828,6);
if (Check11){
DisablePlayerCheckpoint(Check11);
Check12 = SetPlayerCheckpoint(playerid,1642.8663,-1872.3989,13.3828,6);
if (Check12){
DisablePlayerCheckpoint(Check12);
Check13 = SetPlayerCheckpoint(playerid,1501.2822,-1859.5732,13.5469,3);
if (Check13){
DisablePlayerCheckpoint(Check13);
Check14 = SetPlayerCheckpoint(playerid,1404.2217,-1838.4891,13.5469,6);
if (Check14){
DisablePlayerCheckpoint(Check14);
Check15 = SetPlayerCheckpoint(playerid,1366.1760,-1819.7883,13.5628,6);
if (Check15){
DisablePlayerCheckpoint(Check15);
Check16 = SetPlayerCheckpoint(playerid,1339.6797,-1768.3707,13.5354,6);
if (Check16){
DisablePlayerCheckpoint(Check16);
Check17 = SetPlayerCheckpoint(playerid,1357.2197,-1677.1100,13.5974,6);
if (Check17){
DisablePlayerCheckpoint(Check17);
Check18 = SetPlayerCheckpoint(playerid,1386.3151,-1547.2966,13.3974,6);
if (Check18){
DisablePlayerCheckpoint(Check18);
Check19 = SetPlayerCheckpoint(playerid,1397.0167,-1423.2772,13.3828,6);
if (Check19){
DisablePlayerCheckpoint(Check19);
Check20 = SetPlayerCheckpoint(playerid,1185.8276,-1399.9023,13.2021,6);
if (Check20){
DisablePlayerCheckpoint(Check20);
Check21 = SetPlayerCheckpoint(playerid,1144.1449,-1363.2299,13.7184,6);
if (Check21){
DisablePlayerCheckpoint(Check21);
Check22 = SetPlayerCheckpoint(playerid,1085.8591,-1335.0977,13.6467,6);
if (Check22){
DisablePlayerCheckpoint(Check22);
Check23 = SetPlayerCheckpoint(playerid,917.3154,-1384.5354,13.2335,6);
if (Check23){
DisablePlayerCheckpoint(Check23);
Check24 = SetPlayerCheckpoint(playerid,866.9455,-1360.3541,13.5736,3);
if (Check24){
DisablePlayerCheckpoint(Check24);
Check25 = SetPlayerCheckpoint(playerid,796.9495,-1378.7316,13.4033,6);
if (Check25){
DisablePlayerCheckpoint(Check25);
Check26 = SetPlayerCheckpoint(playerid,778.9990,-1050.0117,24.4375,6);
if (Check26){
DisablePlayerCheckpoint(Check26);
Check27 = SetPlayerCheckpoint(playerid,534.5603,-1246.4725,16.4835,6);
if (Check27){
DisablePlayerCheckpoint(Check3);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
return 1;
}

(En passant, y a pas un trucs pour qu'une accolade compte pour plusieurs ? :D)

Donc mon problème :
Le premier CP apparaît, je le prend il disparaît et ensuite c'est le dernier des CP qui apparaît... Je dois sûrement faire une faute bête qui me fait pêter un cable.  :wall

Hors ligne Bayshore

  • *
  • Grand Banditisme
  • Messages: 923
    • Voir le profil
Re : Re : CheckPoint, Problème...
« Réponse #7 le: 01 Juillet 2008, 20:00:38 »
Ton code est une horreur, il manque des accolades toutes les trois lignes. ;D
Il faut indenter son code jeune homme. :happy
~> http://forum.sa-mp.com/index.php?topic=61893.0

Sinon, tu n'as pas trop l'air d'avoir compris :
Un CP ne renvoi pas de valeur (normal vu que tu ne peut mettre qu'un CP), donc tu ne peut pas faire Check1 = SetPlayerRaceCheckpoint, il faudra utiliser une variable alternative (cf: fin du post).
Aussi, DisablePlayerCheckpoint ne fonctionne pas comme tu fais (vu qu'un CP ne retourne rien).
~> http://streetplaya.hopto.org/SAMP_Wiki/wiki.sa-mp.com/wiki/DisablePlayerRaceCheckpoint.html

(En passant, y a pas un trucs pour qu'une accolade compte pour plusieurs ? :D)
Utilise un switch. ;)

Voici comment se servir d'un switch et utiliser une variable qui contiendra le numéro du CP :
Dans OnGameModeInit :
Code: (pawn) [Sélectionner]
new CP;
Dans ta commande ou ton public qui fait que la course démarre :
Code: (pawn) [Sélectionner]
CP = 0;
SetPlayerRaceCheckpoint(TonPremierCP);

Dans OnPlayerEnterRaceCheckpoint :
Code: (pawn) [Sélectionner]
switch(CP)
{
    case 0:
    {
        DisablePlayerCheckpoint(playerid);
        SetPlayerCheckpoint(TonPremierCP);
    }

    case 1:
    {
        DisablePlayerCheckpoint(playerid);
        SetPlayerCheckpoint(TonDeuxièmeCP);
    }
    //etc.
}
CP++;


Voila ça devrait t'aider; ne fait pas que copier-coller et regarde les liens que je t'ai donné. :)

++
Alexandre