GTAOnline.net

San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: ApocKalipsS le 30 Janvier 2008, 16:39:24

Titre: Problème commandes...
Posté par: ApocKalipsS le 30 Janvier 2008, 16:39:24
 Bonjour,
Alors j'ai fait un FS de permis de conduire mais les commandes beug un peu...

if(strcmp(cmdtext, "/licensev", true) == 0)
        {
        if(Instructeur == 1)
{
                new pid, tmpp[256],tmpp1[256];
                tmpp = strtok(cmdtext, idx);
                
                if      (!strlen(tmpp))
                {
                        SendClientMessage(playerid, COLOR_GREEN, "USAGE: /licensev [Playerid] [Conclusion]");
                        return 1;
                }
                pid = strval(tmpp);
                if      (!(IsPlayerConnected(pid)))
                {
                        SendClientMessage(playerid, COLOR_RED, "Ce joueur n'est pas connecter !");
                        return 1;
                }
                GetPlayerName(pid, pidName, sizeof(pidName));
                format(tmpp, sizeof(tmpp), "Tu as donner le permis voiture à %s (ID:%s).|Conclusion : %s ",pidName,pid,cmdtext[idx]);
                SendClientMessage(playerid, 0xAA3333AA, tmpp);
                SendClientMessage(pid,0xAA3333AA, "_________________________________________________");
                format(tmpp1, sizeof(tmpp1), "%s ta donner le permis voiture.|Conclusion : %s",playerid, cmdtext[idx]);
                SendClientMessage(pid,0xAA3333AA, tmpp1);
PermisV = 1;
                return 1;
}else if(Instructeur ==0) {
                SendClientMessage(playerid, COLOR_RED, "Tu n'est pas Instructeur !");
                }
        }

if(strcmp(cmdtext, "/instructeur", true) == 0)
        {
             new message[127];
                new pid, tmp[256], tmpp[256];
                tmp = strtok(cmdtext, idx);
                tmpp = strtok(cmdtext, idx);
if(IsPlayerAdmin(playerid))
{
                if      (!strlen(tmpp))
                {
                        SendClientMessage(playerid, COLOR_GREEN, "USAGE: /instructeur [Playerid] [Message]");
                        return 1;
                }

                pid = strval(tmpp);
                if      (!(IsPlayerConnected(pid)))
                {
                        SendClientMessage(playerid, COLOR_RED, "Ce joueur n'est pas connecter !");
                        return 1;
                }
                GetPlayerName(pid, pidName, sizeof(pidName));
                format(tmpp, sizeof(tmpp), "Tu as mit %s (ID:%d) 'Instructeur'.",pidName,pid);
                SendClientMessage(playerid, 0xAA3333AA, tmpp);
             GetPlayerName(playerid, message, sizeof(message));
                format(tmpp, sizeof(tmpp), "Un admin ta mit Instructeur ! |Message : %s", cmdtext[idx]);
                SendClientMessage(pid,0xAA3333AA, tmpp);
   SendInstructorMessage(COLOR_RED, "Un joueur à rejoins le job : Instructeur !");
   Instructeur = 1;
                }else{
               SendClientMessage(playerid, COLOR_RED, "Tu n'est pas Admin !");
                                           }

Pour le "/instructeur" je tape "/instructeur [ID] [MESSAGE]" et rien ne se passe...
Mais si je tape "/instructeur" tous court, ca me marque :
%s(l'id 0 quoi) est maintenant instructeur

Pour le licensev pareille....
Quel est l'erreur ? :blink
Titre: Re : Problème commandes...
Posté par: UrbanGhetto le 31 Janvier 2008, 12:59:12
Pourquoi, Qu'es-ce qu'il est sensé ce passer ?
Titre: Re : Problème commandes...
Posté par: triton le 31 Janvier 2008, 14:46:34
Salut, teste ça .
        if(strcmp(cmdtext, "/licensev", true) == 0){
        new pid, tmp[256],tmpp[256],tmpp1[256],tmpp2[256],pidName[MAX_PLAYER_NAME];
        tmp = strtok(cmdtext, idx);
        tmpp = strtok(cmdtext, idx);
        pid = strval(tmp);
        if(Instructeur [playerid] == 1){
        if(!strlen(tmp)){
        SendClientMessage(playerid, COLOR_GREEN, "USAGE: /licensev [Playerid] [Conclusion]");
        return 1;}
        if(IsPlayerConnected(pid)){
        GetPlayerName(pid, pidName, sizeof(pidName));
        format(tmpp1, sizeof(tmpp1), "Tu as donner le permis voiture à %s (ID:%d).|Conclusion : %s ",pidName,pid,cmdtext[10]);
        SendClientMessage(playerid, 0xAA3333AA, tmpp1);
        SendClientMessage(pid,0xAA3333AA, "_________________________________________________");
        format(tmpp2, sizeof(tmpp2), "%s ta donner le permis voiture.|Conclusion : %s",playerid, cmdtext[10]);
        SendClientMessage(pid,0xAA3333AA, tmpp2);
PermisV [pid]= 1;
}else{
        SendClientMessage(playerid, COLOR_RED, "Ce joueur n'est pas connecter !");}
}else{
        SendClientMessage(playerid, COLOR_RED, "Tu n'est pas Instructeur !");}     
        }

++
Titre: Re : Problème commandes...
Posté par: ApocKalipsS le 01 Février 2008, 20:19:37
Enfaite il détécte pas les [playerid] et [pid] donc ca me fait des erreurs...
Titre: Re : Problème commandes...
Posté par: R@f le 01 Février 2008, 22:22:19
je vais prendre mon temps pour regarder ta commande demain ;) là je vais me coucher, je suis spécialiste en commande avec des chaines comme ID du joueur, ID armes, etc... :)

++
R@f
Titre: Re : Problème commandes...
Posté par: ApocKalipsS le 02 Février 2008, 08:21:56
Oki merci R@f !

Je vais voir ton FS "RAS" pour m'aider si je vois la réponse...
Titre: Re : Problème commandes...
Posté par: R@f le 02 Février 2008, 11:48:36
j'ai trouvé le problème je pense... c'est que fallait mettre "cmd" à la place de "cmdtext"
Voila la correction sous forme de FS : http://raf14.pastebin.ca/888725
il faut juste alligner le code correctement pour éviter les warnings ;)

++
R@f
Titre: Re : Problème commandes...
Posté par: ApocKalipsS le 02 Février 2008, 12:32:47
OKi merci R@f ca marche !


2° question : comment faire pour save la variable à sa prochaine connection ?
Titre: Re : Problème commandes...
Posté par: R@f le 02 Février 2008, 13:02:31
utilise dini ;)

++
R@f
Titre: Re : Problème commandes...
Posté par: ApocKalipsS le 02 Février 2008, 17:07:27
Dini, l'include ?

Comment ça ? 0_o
Titre: Re : Problème commandes...
Posté par: R@f le 02 Février 2008, 17:39:54
ouep, l'include dini ;)
donc, voici les quelques lignes qu'il faut, pour la commande entière tu te débrouilles
Code: (cpp) [Sélectionner]
/*dans la commande register*/
dUserSetINT(PlayerName(playerid)).("PermisV",0);
/*dans la commande login*/
PermisV[playerid] =dUserINT(PlayerName(playerid)).("PermisV");
/*dans OnPlayerDisconnect ou dans la commande logout*/
dUserSetINT(PlayerName(playerid)).("PermisV",PermisV[playerid]);
Je pense que c'est comme sa, c'est la première fois que j'utilise dini ;)

++
R@f
Titre: Re : Problème commandes...
Posté par: ApocKalipsS le 02 Février 2008, 18:35:59
Oula rien compris  :blink

Bon je vais demander à un pote qui connais comment faire..
Mais maintenant qu'il a eu son relevé de note...ces parents... ;D