Hey, i have an rp-faction uninvite problem
#1

this is my command:

pawn Код:
if(strcmp(cmd,"/uninvite",true)==0)
            {
                new string1[256];
                new playaname[24];
                new playa[126];
                playa = strtokk(cmdtext, idx);
                GetPlayerName(strval(playa), playaname, sizeof(playaname));
                new pfile1[128];
                format(pfile,sizeof(pfile),"user/%s.ini",playaname);
                if(PlayerInfo[playerid][pLeader] == 1)
                {
                    if(!strlen(playa))
                    {
                        SendClientMessage(playerid,color_white,"USE: /uninvite [playerid]");
                        return 1;
                    }
                    if(strval(playa) != INVALID_PLAYER_ID)
                    {
                        if(IsPlayerConnected(strval(playa)))
                        {
                           
                            PlayerInfo[strval(playa)][pLFaction] = 0;
                            PlayerInfo[strval(playa)][pLRank] = 0;
                            dini_Set(pfile1, "LFaction", PlayerInfo[strval(playa)][pLRank]);
                            dini_Set(pfile1, "Rank", PlayerInfo[strval(playa)][pLFaction]);
                            format(string, sizeof(string), "The leader %s [%d] kicked you from his faction",playername,playerid);
                            SendClientMessage(strval(playa),color_white,string);
                            format(string, sizeof(string), "You uninvite id %d from your faction",strval(playa));
                            SendClientMessage(playerid,color_white,string1);
                            return 1;
                        }
                        else if(!IsPlayerConnected(strval(playa)))
                        {
                            SendClientMessage(playerid,color_red,"This player isn't connected!");
                            return 1;
                        }
                    }
                    else if(strval(playa) == INVALID_PLAYER_ID)
                    {
                        SendClientMessage(playerid,color_red,"This is an Invlid player id");
                        return 1;
                    }
                }
                else if(PlayerInfo[playerid][pLeader] == 0)
                {
                    SendClientMessage(playerid,color_red,"You aren't a leader");
                    return 1;
                }
            }
it does uninvite me, though when i relog i'm back in the faction... why?
Reply
#2

i see you got the dini's turned around:
Код:
dini_Set(pfile1, "LFaction", PlayerInfo[strval(playa)][pLRank]);
dini_Set(pfile1, "Rank", PlayerInfo[strval(playa)][pLFaction]);
must be:
Код:
dini_Set(pfile1, "Rank", PlayerInfo[strval(playa)][pLRank]);
dini_Set(pfile1, "LFaction", PlayerInfo[strval(playa)][pLFaction]);
and this:
Код:
playa = strtokk(cmdtext, idx);
must be:
Код:
playa = strtok(cmdtext, idx);
and try using sscanf..
Reply
#3

Well, you can't know that the problem is in the variable of "pfaction" and "plrank" because you didn't see the definition of this variable. The problem was in the definition of pfile. I wrote "new pfile1" and I did the format for "pfile".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)