My /invite cmd..
#3

Lets see, if I understand your command correctly, it does this: You invite a player (where in your command id = the playerid of the player you want to invite?) to the group you are currently in?

pawn Код:
CMD:invite(playerid,params[])
{
    new string[128],id,sendername[MAX_PLAYER_NAME];
    if(PlayerInfo[playerid][pGroup] <= 0) return SendClientMessage(playerid,COLOR_GRAY,"You're not part of a group!");
    else if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_GRAY,"Syntax: /invite [id]");
    else if(id==INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_GRAY,"Error: Player is not connected!");
    else
    {
        PlayerInfo[playerid][pRank] = 1;
        GetPlayerName(playerid, sendername, sizeof(sendername));
        /*if(PlayerInfo[playerid][pGroup] == 1) return PlayerInfo[id][pGroup] == 1;
        else if(PlayerInfo[playerid][pGroup] == 2) return PlayerInfo[id][pGroup] == 2;
        else if(PlayerInfo[playerid][pGroup] == 3) return PlayerInfo[id][pGroup] == 3;
        else if(PlayerInfo[playerid][pGroup] == 4) return PlayerInfo[id][pGroup] == 4;
        else if(PlayerInfo[playerid][pGroup] == 5) return PlayerInfo[id][pGroup] == 5;
        else if(PlayerInfo[playerid][pGroup] == 6) return PlayerInfo[id][pGroup] == 6;
        else if(PlayerInfo[playerid][pGroup] == 7) return PlayerInfo[id][pGroup] == 7;
        else if(PlayerInfo[playerid][pGroup] == 8) return PlayerInfo[id][pGroup] == 8;
        else if(PlayerInfo[playerid][pGroup] == 9) return PlayerInfo[id][pGroup] == 9;
        else if(PlayerInfo[playerid][pGroup] == 10) return PlayerInfo[id][pGroup] == 10;
                */

          PlayerInfo[id][pGroup] = PlayerInfo[playerid][pGroup];
        format(string,sizeof(string),"[INVITE] %s has invited you to group %d",sendername,id);
        SendClientMessage(id,COLOR_YELLOW,string);
    }
    return 1;
}
What I did:
- Removed the line "PlayerInfo[playerid][pGroup] = id;" because you were setting the groupid of the player that was inviting to the id of the player he was inviting
- Replaced the commented lines with "PlayerInfo[id][pGroup] = PlayerInfo[playerid][pGroup];"

It was a simple fix, hope it is what you wanted
Reply


Messages In This Thread
My /invite cmd.. - by Azzeto - 28.10.2011, 18:29
Re: My /invite cmd.. - by [MWR]Blood - 28.10.2011, 19:05
Re: My /invite cmd.. - by FUNExtreme - 28.10.2011, 19:35

Forum Jump:


Users browsing this thread: 1 Guest(s)