• 05 Juin 2026, 20:34:57


Auteur Sujet: Problème commandetext  (Lu 903 fois)

0 Membres et 1 Invité sur ce sujet

Hors ligne Ludo43

  • *
  • Tueur en série
  • Derby !
  • Messages: 124
    • Voir le profil
Problème commandetext
« le: 30 Décembre 2010, 15:46:45 »
Bonjour à tous,

Voila mon début de code :
public OnPlayerCommandText(playerid, cmdtext[])
{
if(IsPlayerNPC(playerid)){return 1;}
    dcmd(specplayer, 10, cmdtext);
    dcmd(specoff, 7, cmdtext);
new string[256];
new playermoney;
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new playername[MAX_PLAYER_NAME];
new cmd[256];
new tmp[256];
new giveplayerid, moneys, idx;
new idcar = GetPlayerVehicleID(playerid);
new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
cmd = strtok(cmdtext, idx);
if(strcmp( cmd, "/localisation", true ) == 0)
{
if(!(PlayerInfo[playerid][pAdmin] >= 9999))
{
    return 0;
}
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0)
{
    return SendClientMessage(playerid,COLOR_GREEN,"/localisation <id>");
}
new id = strval(tmp);
if(!IsPlayerConnected(id))
{
return SendClientMessage(playerid,COLOR_GREEN,"Pas connecter");
}
SetPlayerMarkerForPlayer(playerid, id,COLOR_BLUE);
SendClientMessage(playerid,COLOR_GREEN,"Localisé, Monsieur L'Admin");
return 1;
}
if(strcmp( cmd, "/test", true ) == 0)
{
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0)
{
    return SendClientMessage(playerid,COLOR_GREEN,"/fight <id> 4,5,6,7,15,26");
}
new style = strval(tmp);
SetPlayerSpecialAction(playerid,style);
format(tmp, 52, "action mis à %d", style);
SendClientMessage(playerid,COLOR_GREEN,tmp);
return 1;
}
if(strcmp( cmd, "/fight", true ) == 0)
{
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0)
{
    return SendClientMessage(playerid,COLOR_GREEN,"/fight <id> 4,5,6,7,15,26");
}
new style = strval(tmp);
if(!(style >= 4 && style <= 7 || style == 15 || style == 26))
{
return SendClientMessage(playerid,COLOR_GREEN,"/fight <id> 4,5,6,7,15,26");
}
SetPlayerFightingStyle(playerid, style);
format(tmp, 52, "Style de combat mis a %d", style);
SendClientMessage(playerid,COLOR_GREEN,tmp);
return 1;
}

Mon problème est le suivant, lorsque je tape /fight, ça me sort la localisation, quoi que je tape, même : /kgopzekop
Bref, j'ai déjà été regarder un topic, ça ne marche pas.

j'ai également insérer ce code plus haut :

strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index <length> ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

Merci à vous de votre précieuse aide :).
| Derby en cours de script ! |

Si tu veux m'aider n'hésite pas ! : http://www.gtaonline.fr/forums/index.php?action=pm;sa=send;u=10160


@ Bientot !

Hors ligne Pixect

  • Verbal Criminal
  • *
  • Tueur en série
  • ser la fèt isi, tqvu
  • Messages: 219
    • Voir le profil
Re : Problème commandetext
« Réponse #1 le: 30 Décembre 2010, 16:31:47 »
Salut,

La CallBack OnPlayerCommandText doit retourner 0. L'as-tu fait ?

++
Lloyd


Citation de: Stéphane ARLEN
« Défendre le c cédille majuscule n’est-il pas vain ? Ca m’isole, comme disent les fous. »

S'il vous plaît, passez par ici si vous avez le temps.

Hors ligne Ludo43

  • *
  • Tueur en série
  • Derby !
  • Messages: 124
    • Voir le profil
Re : Problème commandetext
« Réponse #2 le: 30 Décembre 2010, 16:41:29 »
Merci, non, il était à 1, je test tout ça.

ça ne marche toujours pas... d'autres propositions ?
« Modifié: 30 Décembre 2010, 16:46:53 par Ludo43 »
| Derby en cours de script ! |

Si tu veux m'aider n'hésite pas ! : http://www.gtaonline.fr/forums/index.php?action=pm;sa=send;u=10160


@ Bientot !