/invite help?
#1

Hey folks,
I made the script today and tried to make an /invite command, but it didnt work - it always doesent do anything, but just doesent say unknown command too. Here's the command:
pawn Код:
if(strcmp(cmd, "/invite", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "KASUTUS: /invite [mдngijaID/OsaNimest]");
                return 1;
            }
            new para1;
            new ftext[20];
            para1 = ReturnUser(tmp);
            if (PlayerInfo[playerid][pRank] == 10 && PlayerInfo[playerid][pMember] >= 1)
            {
                if(IsPlayerConnected(para1))
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        if (PlayerInfo[para1][pMember] == 0 && PlayerInfo[para1][pFMember] == 255)
                        {
                            if(PlayerInfo[playerid][pLeader] == 1) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "Police Force"; ChosenSkin[para1] = 71; SetPlayerSkin(para1, 71); }
                            else if(PlayerInfo[playerid][pLeader] == 2) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "FBI/ATF"; ChosenSkin[para1] = 286; SetPlayerSkin(para1, 286); }
                            else if(PlayerInfo[playerid][pLeader] == 3) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "National Guard"; ChosenSkin[para1] = 287; SetPlayerSkin(para1, 287); }
                            else if(PlayerInfo[playerid][pLeader] == 4) { PlayerInfo[para1][pTeam] = 1; gTeam[para1] = 1; ftext = "Firemen/Ambulance"; ChosenSkin[para1] = 70; SetPlayerSkin(para1, 70); }
                            else if(PlayerInfo[playerid][pLeader] == 5) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "F13"; ChosenSkin[para1] = 116; SetPlayerSkin(para1, 116); }
                            else if(PlayerInfo[playerid][pLeader] == 6) { PlayerInfo[para1][pTeam] = 6; gTeam[para1] = 6; ftext = "La Eme"; ChosenSkin[para1] = 240; SetPlayerSkin(para1, 240); }
                            else if(PlayerInfo[playerid][pLeader] == 7) { return 1; }
                            else if(PlayerInfo[playerid][pLeader] == 8) { PlayerInfo[para1][pTeam] = 10; gTeam[para1] = 12; ftext = "Hitman Agency"; ChosenSkin[para1] = 249; SetPlayerSkin(para1, 249); }
                            else if(PlayerInfo[playerid][pLeader] == 9) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "Hi K69 Radio"; ChosenSkin[para1] = 148; SetPlayerSkin(para1, 148); }
                            else if(PlayerInfo[playerid][pLeader] == 10) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "Taxi Cab Company"; ChosenSkin[para1] = 255; SetPlayerSkin(para1, 255); }
                            else if(PlayerInfo[playerid][pLeader] == 11) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "School Instructors"; ChosenSkin[para1] = 59; SetPlayerSkin(para1, 59); }
                            //else if(PlayerInfo[playerid][pLeader] == 14) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "Yamaguchi"; ChosenSkin[para1] = 169; SetPlayerSkin(para1, 169); }
                            else if(PlayerInfo[playerid][pLeader] == 15) { PlayerInfo[para1][pTeam] = 15; gTeam[para1] = 15; ftext = "Mongols MC"; ChosenSkin[para1] = 254; SetPlayerSkin(para1, 254); }
                            else if(PlayerInfo[playerid][pLeader] == 16) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "Money Ova' Bitches"; ChosenSkin[para1] = 7; SetPlayerSkin(para1, 7); }
                            else { return 1; }
                            GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            PlayerInfo[para1][pMember] = PlayerInfo[playerid][pLeader];
                            PlayerInfo[para1][pRank] = 1;
                        //  PlayerInfo[para1][pFactionIden]=FamilyInfo[PlayerInfo[playerid][pMember]][FamilyIden];
                            printf("AdmCmd: %s has invited %s to join %s.", sendername, giveplayer, ftext);
                            format(string, sizeof(string), "   You have Joined the %s, you were invited by Leader %s", FamilyInfo[PlayerInfo[playerid][pMember]][FamilyName], sendername);
                            SendClientMessage(para1, COLOR_WHITE, string);
                            format(string, sizeof(string), "   You have Invited %s to join the %s.", giveplayer,FamilyInfo[PlayerInfo[playerid][pMember]][FamilyName]);
                            SendClientMessage(playerid, COLOR_WHITE, string);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "  That player is currently Wanted / a Different Team / or already a Family Member.");
                            return 1;
                        }
                    }
                }//not connected
            }
        /*  if(PlayerInfo[playerid][pLeader] == 0)
            {
                if(PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] >= 6)
                {
                    PlayerInfo[para1][pTeam] = 2;
                    gTeam[para1] = 2;
                    ftext = "Police Force";
                    ChosenSkin[para1] = 71;
                    SetPlayerSkin(para1, 71);
                    GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    PlayerInfo[para1][pMember] = PlayerInfo[playerid][pMember];
                    PlayerInfo[para1][pRank] = 1;
                    printf("AdmCmd: %s has invited %s to join %s.", sendername, giveplayer, ftext);
                    format(string, sizeof(string), "   You have Joined the %s, you were invited by Leader %s", ftext, sendername);
                    SendClientMessage(para1, COLOR_WHITE, string);
                    format(string, sizeof(string), "   You have Invited %s to join the %s.", giveplayer,ftext);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                }
            }*/

            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   Sul pole хigusi selle kдskluse kasutamiseks(leaders only)!");
            }
        }
        return 1;
    }
Reply
#2

Proovi seda / Try this:
pawn Код:
if(strcmp(cmd, "/invite", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GRAD2, "KASUTUS: /invite [mдngijaID/OsaNimest]");
            return 1;
        }
        new para1;
        new ftext[20];
        para1 = ReturnUser(tmp);
        if (PlayerInfo[playerid][pRank] == 10 && PlayerInfo[playerid][pMember] >= 1)
        {
            if(IsPlayerConnected(para1))
            {
                if (PlayerInfo[para1][pMember] == 0 && PlayerInfo[para1][pFMember] == 255)
                {
                    if(PlayerInfo[playerid][pLeader] == 1) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "Police Force"; ChosenSkin[para1] = 71; SetPlayerSkin(para1, 71); }
                    else if(PlayerInfo[playerid][pLeader] == 2) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "FBI/ATF"; ChosenSkin[para1] = 286; SetPlayerSkin(para1, 286); }
                    else if(PlayerInfo[playerid][pLeader] == 3) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "National Guard"; ChosenSkin[para1] = 287; SetPlayerSkin(para1, 287); }
                    else if(PlayerInfo[playerid][pLeader] == 4) { PlayerInfo[para1][pTeam] = 1; gTeam[para1] = 1; ftext = "Firemen/Ambulance"; ChosenSkin[para1] = 70; SetPlayerSkin(para1, 70); }
                    else if(PlayerInfo[playerid][pLeader] == 5) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "F13"; ChosenSkin[para1] = 116; SetPlayerSkin(para1, 116); }
                    else if(PlayerInfo[playerid][pLeader] == 6) { PlayerInfo[para1][pTeam] = 6; gTeam[para1] = 6; ftext = "La Eme"; ChosenSkin[para1] = 240; SetPlayerSkin(para1, 240); }
                    else if(PlayerInfo[playerid][pLeader] == 7) { return 1; }
                    else if(PlayerInfo[playerid][pLeader] == 8) { PlayerInfo[para1][pTeam] = 10; gTeam[para1] = 12; ftext = "Hitman Agency"; ChosenSkin[para1] = 249; SetPlayerSkin(para1, 249); }
                    else if(PlayerInfo[playerid][pLeader] == 9) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "Hi K69 Radio"; ChosenSkin[para1] = 148; SetPlayerSkin(para1, 148); }
                    else if(PlayerInfo[playerid][pLeader] == 10) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "Taxi Cab Company"; ChosenSkin[para1] = 255; SetPlayerSkin(para1, 255); }
                    else if(PlayerInfo[playerid][pLeader] == 11) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "School Instructors"; ChosenSkin[para1] = 59; SetPlayerSkin(para1, 59); }
                    else if(PlayerInfo[playerid][pLeader] == 15) { PlayerInfo[para1][pTeam] = 15; gTeam[para1] = 15; ftext = "Mongols MC"; ChosenSkin[para1] = 254; SetPlayerSkin(para1, 254); }
                    else if(PlayerInfo[playerid][pLeader] == 16) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "Money Ova' Bitches"; ChosenSkin[para1] = 7; SetPlayerSkin(para1, 7); }
                    else { return 1; }
                    GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    PlayerInfo[para1][pMember] = PlayerInfo[playerid][pLeader];
                    PlayerInfo[para1][pRank] = 1;
                    printf("AdmCmd: %s kutsus %s liituma %s'iga.", sendername, giveplayer, ftext);
                    format(string, sizeof(string), "   Sa liitusid %s'iga, sind kutsus liider %s", FamilyInfo[PlayerInfo[playerid][pMember]][FamilyName], sendername);
                    SendClientMessage(para1, COLOR_WHITE, string);
                    format(string, sizeof(string), "   Kutsusid %s liituma %s'iga.", giveplayer,FamilyInfo[PlayerInfo[playerid][pMember]][FamilyName]);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "  See mдngija on Tagaotsitav / Teises Tiimis / Vхi juba teises peres .");
                    return 1;
                }
            }
            else SendClientMessage(playerid, COLOR_GRAD1, "   Ei leia mдngijat!");

        }
        else SendClientMessage(playerid, COLOR_GRAD1, "   Sul pole хigusi selle kдskluse kasutamiseks(leaders only)!");

    } // Not Connected
    return 1;
}
Reply
#3

If you want to make the code a bit more efficient and save some lines, you'd better change to zcmd and sscanf.

And for the :PlayerInfo[playerid][pLeader] part.

pawn Код:
swtich(PlayerInfo[playerid][pLeader])
{
     case 1: {} // Does shit if PlayerInfo[playerid][pLeader] == 1;
}

ZCMD + SScanf Example:
pawn Код:
command(invite, playerid, params[])
{
    new iId;
    if(sscanf(params, "i", iId)) return SendClientMessage(playerid, COLOR_GRAD2, "KASUTUS: /invite [mдngijaID/OsaNimest]");
    if (PlayerInfo[para1][pMember] == 0 && PlayerInfo[para1][pFMember] == 255)
    {
        switch(PlayerInfo[playerid][pLeader])
        {
            case 1: // Could also add multiple cases like this: case 1,2,3: {}
            {
                PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "Police Force"; ChosenSkin[para1] = 71; SetPlayerSkin(para1, 71);
            }
        }
    }
    return 1;
}
Didn't compile this.
Reply
#4

Thanks guys will edit it, when ill get the server on and compiled.

// DIDNT WORK, i didnt try yours Cameltoe, i just want the strtok one.
Reply
#5

Quote:
Originally Posted by Spiral
Посмотреть сообщение
Thanks guys will edit it, when ill get the server on and compiled.

// DIDNT WORK, i didnt try yours Cameltoe, i just want the strtok one.
Your call, im just saying it would make your script more efficient strcmp is kinda oldschool.
Reply
#6

Help please? The solutions didnt work, please help?
Reply
#7

What's the matter?
Reply
#8

Look at the posts - it doesent say anything, but it doesent say unknown command though.
Reply
#9

Quote:
Originally Posted by Spiral
Посмотреть сообщение
Look at the posts - it doesent say anything, but it doesent say unknown command though.
In the one i made, theres only one scm add some scm's and you will get something said.
Reply
#10

Ill try to compile n' test.
Reply
#11

Didn't work. Any suggestions?
Reply
#12

Quote:
Originally Posted by Spiral
Посмотреть сообщение
Didn't work. Any suggestions?
What didn't work? Describe the problem.
Reply
#13

The same as before, oh and though, I prefer strtok, if you could find a solution it'd be SUPERB, though, i looked at the /makeleader command and think theres solution which I cant find, heres the /makeleader -
pawn Код:
if(strcmp(cmd, "/makeleader", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "KASUTUS: /makeleader [mдngijaID/OsaNimest] [Number(1-10)]");
                return 1;
            }
            new para1;
            new level;
            para1 = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            level = strval(tmp);
            if(level > 16 || level < 0) { SendClientMessage(playerid, COLOR_GREY, "   Dont go below number 0, or above number 16!"); return 1; }
            if (PlayerInfo[playerid][pAdmin] >= 4)
            {
                if(IsPlayerConnected(para1))
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        /*if(PlayerInfo[para1][pMember] > 0 || PlayerInfo[para1][pFMember] < 255)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "   That player is in a Faction / Family !");
                            return 1;
                        }*/

                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        PlayerInfo[para1][pMember] = level;
                        PlayerInfo[para1][pRank] = 10;
                        format(string, sizeof(string), "   Sa oled nььd fraktsiooni liider %s poolt", sendername);
                        SendClientMessage(para1, COLOR_WHITE, string);
                        format(string, sizeof(string), "   You have given %s control to run Faction Number %d.", giveplayer,level);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        if(level == 0) { PlayerInfo[para1][pChar] = 0; PlayerInfo[para1][pRank] = 0; gTeam[para1] = 3; PlayerInfo[para1][pTeam] = 0; return 1; }
                        else if(level == 1) { PlayerInfo[para1][pChar] = 288; } //Police Force
                        else if(level == 2) { PlayerInfo[para1][pChar] = 286; } //FBI/ATF
                        else if(level == 3) { PlayerInfo[para1][pChar] = 287; } //National Guard
                        else if(level == 4) { PlayerInfo[para1][pChar] = 228; } //Fire/Ambulance
                        else if(level == 5) { PlayerInfo[para1][pChar] = 115; } //F13
                        else if(level == 6) { PlayerInfo[para1][pChar] = 124; } //La Eme
                        else if(level == 7) { PlayerInfo[para1][pChar] = 147; } //Mayor
                        else if(level == 8) { PlayerInfo[para1][pChar] = 20; } //Hitmans
                        else if(level == 9) { PlayerInfo[para1][pChar] = 227; } //News Reporters
                        else if(level == 10) { PlayerInfo[para1][pChar] = 61; } //Taxi Cab Company
                        else if(level == 11) { PlayerInfo[para1][pChar] = 171; } //Driving/Flying School
                        else if(level == 14) { PlayerInfo[para1][pChar] = 294; } //Yamaguchi
                        else if(level == 15) { PlayerInfo[para1][pChar] = 100; } //Bikers
                        else if(level == 16) { PlayerInfo[para1][pChar] = 296; } //MOB

                        if(level == 0)
                        {
                            gTeam[para1] = 3;
                            PlayerInfo[para1][pTeam] = 3;
                        }
                        else if(level == 1 || level == 2 || level == 3)
                        {
                            gTeam[para1] = 2;
                            PlayerInfo[para1][pTeam] = 2;
                            SendClientMessage(para1,COLOR_WHITE,"[INFO]: Type /factionhelp to learn how to build your faction.");
                        }
                        else if(level == 4)
                        {
                            gTeam[para1] = 1;
                            PlayerInfo[para1][pTeam] = 1;
                            SendClientMessage(para1,COLOR_WHITE,"[INFO]: Type /factionhelp to learn how to build your faction.");
                        }
                        else
                        {
                            gTeam[para1] = 15;
                            PlayerInfo[para1][pTeam] = 15;
                            SendClientMessage(para1,COLOR_WHITE,"[INFO]: Type /factionhelp to learn how to build your faction.");
                        }

                        SetPlayerSkin(para1, PlayerInfo[para1][pChar]);

                        if(level == 0)
                        {
                            PlayerInfo[para1][pRank] = 0;
                        }
                        else
                        {
                            PlayerInfo[para1][pRank] = 10;
                        }
                    }
                }//not connected
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   Sul pole хigusi selle kдskluse kasutamiseks!");
            }
        }
        return 1;
    }
Reply
#14

Bring
Up
My
Post
Pl0x. I need help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)