ZCMD - Subcmd, problem.
#1

pawn Код:
CMD:section(playerid, params[])
{
    new string[145], param[24];
    if(gPlayerLogged[playerid] != 1) return SendClientMessage(playerid, COULEUR_ROUGE, "(Erreur) {FF4747}Vous n'кtes pas connectй au serveur.");
    if(PlayerInfo[playerid][pLeaderSection] == 0 || PlayerInfo[playerid][pSection] == 0) return SendClientMessage(playerid, COULEUR_ROUGE, "(Erreur) {FF4747}Vous n'кtes pas membre d'une section.");
    if(sscanf(params, "s[24]", param))
    {
        SendClientMessage(playerid, COULEUR_BLANCHE, "(Utilisation) /section [Nom]");
        return SendClientMessage(playerid, COULEUR_BLANCHE, "(Utilisation) Noms: membres - donnerrang - virer - inviter.");
    }

    if(!strcmp(param, "membres", true))
    {
        SendClientMessage(playerid, COULEUR_VERT_CLAIR, "Membre de votre section en ligne:");
        foreach(new i : Player)
        {
            if(PlayerInfo[playerid][pSection] == PlayerInfo[i][pSection])
            {
                format(string, sizeof(string), "* %s (%d) - Rang %d.", GetPseudoJoueur(i), i, PlayerInfo[i][pRangSection]);
                SendClientMessage(playerid, COULEUR_BLANCHE, string);
            }
        }
    }
    else if(!strcmp(param, "inviter", true))
    {
        new targetid;
        if(PlayerInfo[playerid][pRangSection] < 4 || PlayerInfo[playerid][pLeaderSection] == 0) return SendClientMessage(playerid, COULEUR_ROUGE, "(Erreur) {FF4747}Vous n'avez pas accиs а cette commande.");
        if(sscanf(param,"u", targetid)) return SendClientMessage(playerid, COULEUR_BLANCHE, "(Utilisation) /section inviter [ID/Nom du joueur]");
        if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COULEUR_ROUGE, "(Erreur) {FF4747}Ce joueur n'est pas connectй.");
        if(PlayerInfo[targetid][pSection] != PlayerInfo[playerid][pSection]) return SendClientMessage(playerid, COULEUR_ROUGE, "(Erreur) {FF4747}Ce joueur n'est pas dans votre section.");

        format(string, sizeof(string), "(Section) Vous avez йtй invitй dans la section %s par %s.", GetSectionJoueur(playerid), GetPseudoJoueur(playerid));
        SendClientMessage(targetid, COULEUR_BLANCHE, string);
        format(string, sizeof(string), "(Section) Vous avez invitй %s dans votre section.", GetPseudoJoueur(targetid));
        SendClientMessage(playerid, COULEUR_BLANCHE, string);
        PlayerInfo[targetid][pSection] = PlayerInfo[playerid][pSection];
        PlayerInfo[targetid][pRangSection] = 1;
        PlayerInfo[targetid][pLeaderSection] = 0;
    }
    else if(!strcmp(param, "virer", true))
    {
        new targetid;
        if(PlayerInfo[playerid][pRangSection] < 4 || PlayerInfo[playerid][pLeaderSection] == 0) return SendClientMessage(playerid, COULEUR_ROUGE, "(Erreur) {FF4747}Vous n'avez pas accиs а cette commande.");
        if(sscanf(param,"u", targetid)) return SendClientMessage(playerid, COULEUR_BLANCHE, "(Utilisation) /section virer [ID/Nom du joueur]");
        if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COULEUR_ROUGE, "(Erreur) {FF4747}Ce joueur n'est pas connectй.");
        if(PlayerInfo[targetid][pSection] != PlayerInfo[playerid][pSection]) return SendClientMessage(playerid, COULEUR_ROUGE, "(Erreur) {FF4747}Ce joueur n'est pas dans votre section.");

        format(string, sizeof(string), "(Section) Vous avez йtй virй de la section %s par %s.", GetSectionJoueur(playerid), GetPseudoJoueur(playerid));
        SendClientMessage(targetid, COULEUR_BLANCHE, string);
        format(string, sizeof(string), "(Section) Vous avez virй %s de votre section.", GetPseudoJoueur(targetid));
        SendClientMessage(playerid, COULEUR_BLANCHE, string);
        PlayerInfo[targetid][pSection] = 0;
        PlayerInfo[targetid][pRangSection] = 0;
        PlayerInfo[targetid][pLeaderSection] = 0;
    }
    else if(!strcmp(param, "donnerrang", true))
    {
        new targetid, rang;
        if(PlayerInfo[playerid][pRangSection] < 4 || PlayerInfo[playerid][pLeaderSection] == 0) return SendClientMessage(playerid, COULEUR_ROUGE, "(Erreur) {FF4747}Vous n'avez pas accиs а cette commande.");
        if(sscanf(param,"ud", targetid, rang)) return SendClientMessage(playerid, COULEUR_BLANCHE, "(Utilisation) /section donnerrang [ID/Nom du joueur] [Rang (1 а 5)]");
        if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COULEUR_ROUGE, "(Erreur) {FF4747}Ce joueur n'est pas connectй.");
        if(rang < 1 || rang > 5) return SendClientMessage(playerid, COULEUR_ROUGE, "(Erreur) {FF4747}Le rang doit кtre compris entre 1 et 5.");
        if(PlayerInfo[targetid][pSection] != PlayerInfo[playerid][pSection]) return SendClientMessage(playerid, COULEUR_ROUGE, "(Erreur) {FF4747}Ce joueur n'est pas dans votre section.");

        format(string, sizeof(string), "(Section) Vous avez йtй promu au rang %d par %s.", rang, GetPseudoJoueur(playerid));
        SendClientMessage(targetid, COULEUR_BLANCHE, string);
        format(string, sizeof(string), "(Section) Vous avez promu %s au rang %d.", GetPseudoJoueur(targetid), rang);
        SendClientMessage(playerid, COULEUR_BLANCHE, string);
        PlayerInfo[targetid][pRangSection] = rang;
    }
    else return SendClientMessage(playerid, COULEUR_ROUGE, "(Erreur) {FF4747}Nom incorrect.");
    return 1;
}
CMD:s(playerid, params[]) return cmd_section(playerid, params);
When I type, for example, /section donnerrang with nothing after, that return me "(Utilisation) /section donnerrang [ID/Nom du joueur] [Rang (1 а 5)]"
But, when I add something other, like a space, that return me "Nom incorrect".
Why ? Can you help me ?
Reply
#2

I don't understand, What do you want to do here?

pawn Код:
if(sscanf(params, "s[24]", param))
    {
        SendClientMessage(playerid, COULEUR_BLANCHE, "(Utilisation) /section [Nom]");
        return SendClientMessage(playerid, COULEUR_BLANCHE, "(Utilisation) Noms: membres - donnerrang - virer - inviter.");
    }
Reply
#3

I don't know myself ^^'.
I used a lot of method, and i don't find.
Reply
#4

How do you want it to be?
Reply
#5

I need to make a command who as multiple others params, and these params are used on an other player.
Reply
#6

Bump.
Reply
#7

pawn Код:
if(sscanf(params, "s[24]", param)) return SendClientMessage(playerid, COULEUR_BLANCHE, "(Utilisation) /section");
if(!strlen(s)) return SendClientMessage(playerid, COULEUR_BLANCHE, "No spaces");
Reply


Forum Jump:


Users browsing this thread: