SA-MP Forums Archive
[Help]/setvip Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Help]/setvip Problem (/showthread.php?tid=281947)



[Help]/setvip Problem - msvu - 08.09.2011

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


Re: [Help]/setvip Problem - park4bmx - 08.09.2011

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


Re: [Help]/setvip Problem - msvu - 08.09.2011

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


Re: [Help]/setvip Problem - park4bmx - 08.09.2011

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


Re: [Help]/setvip Problem - msvu - 08.09.2011

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