[Help]/setvip Problem
#1

I need help again
I made a /setvip command but the problem is that the command isnt making the selected player a vip it makes me ...

Heres the code
pawn Код:
if(strcmp(cmd, "/setvip", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(IsPlayerAdmin(playerid))
  {
            new INI:File = INI_Open(UserPath(playerid));
            new targetid = strval(tmp);
            if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "Invalid ID!");
            if(!strlen(tmp)) return SendClientMessage(playerid, TEAMCOLOR_PSYCHO, "Usage: /setvip [playerid]");
            INI_SetTag(File,"data");
            INI_WriteInt(File,"VIP",1);
            INI_Close(File);
            PlayerInfo[targetid][pVIP] = 1;
        return 1;
    }
    }
I need help with this part of the code:
Код:
        	INI_SetTag(File,"data");
            INI_WriteInt(File,"VIP",1);
            INI_Close(File);
I dont know how to make the command to edit the selected player's .ini file


Sorry for english
Reply
#2

can you shows the code where u formatted the file?
because where u formatted the file you probably have playerid not targetid
Reply
#3

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
can you shows the code where u formatted the file?
because where u formatted the file you probably have playerid not targetid
Sorry but what shoud I find
Reply
#4

Quote:
Originally Posted by msvu
Посмотреть сообщение
Sorry but what shoud I find
you know you have this
Код:
INI_SetTag(File,"data");
and you have file that file is formatted somewhere
like this !
pawn Код:
new name[MAX_PLAYER_NAME], file[128];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"Any Directory/%s.txt",name)
and you probably have something the same
and when you get the player name you don't get the player that your trying to make VIP but you get your id because you have
Код:
GetPlayerName(playerid, name, sizeof(name));
NOT
Код:
GetPlayerName(targetid, name, sizeof(name));
so that's why it saves the file into your profile
Reply
#5

Ahh now I get it I fixed it Tnx for the help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)