05.02.2017, 19:03
Okay here is the bug.. It's a little bit hard to explain but,
In this gamemode I made a cmd that gives a player a donator level either 1(bronze), 2(silver) or 3(gold)
However, as you can see the code is correct, I guess but when I'm ingame and setting my donator level. It always gives me donator level 1 ! I made this cmd to check my donator level.
It's always showing that I'm a level 1 donator.. lol
In this gamemode I made a cmd that gives a player a donator level either 1(bronze), 2(silver) or 3(gold)
PHP код:
CMD:makedonator(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
new hisfuckingid;
new dlvl;
new vlvl[7];
new expire[11];
if(sscanf(params, "rds[11]", hisfuckingid, dlvl, expire))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /makedonator [playerid] [level] [ExpirationDate]");
return 1;
}
if(PlayerInfo[playerid][pAdmin] > 1336)
{
if(IsPlayerConnected(hisfuckingid))
{
if(hisfuckingid != INVALID_PLAYER_ID)
{
new string[128];
switch(dlvl)
{
case 0:
{
format(string, sizeof(string), "SERVER: Your donator status has been revoked by %s.", GetPlayerNameEx(playerid));
SendClientMessage(hisfuckingid, COLOR_WHITE, string);
format(string, sizeof(string),"ADMCMD: You have revoked %s's donator status.", GetPlayerNameEx(hisfuckingid));
SendClientMessage(playerid, COLOR_ADMIN, string);
PlayerInfo[hisfuckingid][pDonator] = dlvl;
PlayerInfo[hisfuckingid][pDonator] = dlvl;
format(string, sizeof(string), "Accounts/%s.ini", GetPlayerNameEx(hisfuckingid));
DOF2_SetInt(string, "Lvl",PlayerInfo[hisfuckingid][pDonator], "Donator");
DOF2_Unset(string, "Exp", "Donator");
DOF2_SaveFile();
}
case 1:
{
format(string, sizeof(string), "SERVER: You have been made a Bronze donator by %s (ID:%d) until %s.", GetPlayerNameEx(playerid), playerid, expire);
SendClientMessage(hisfuckingid, COLOR_WHITE, string);
format(string, sizeof(string), "ADMCMD: You have made %s a Bronze donator until %s.", GetPlayerNameEx(hisfuckingid), expire);
SendClientMessage(playerid, COLOR_ADMIN, string);
PlayerInfo[hisfuckingid][pDonator] = dlvl;
PlayerInfo[hisfuckingid][pDonator] = dlvl;
format(string, sizeof(string), "Accounts/%s.ini", GetPlayerNameEx(hisfuckingid));
vlvl[0] = DOF2_GetInt(string, "Rcc", "Donator");
vlvl[1] = DOF2_GetInt(string, "Nmc", "Donator");
vlvl[2] = DOF2_GetInt(string, "LPr", "Donator");
vlvl[3] = DOF2_GetInt(string, "Agc", "Donator");
DOF2_SetInt(string, "Lvl",PlayerInfo[hisfuckingid][pDonator],"Donator");
DOF2_SetString(string, "Exp", expire, "Donator");
DOF2_SetInt(string, "Rcc", vlvl[0]+2, "Donator");
DOF2_SetInt(string, "Nmc", vlvl[1]+2, "Donator");
DOF2_SetInt(string, "Agc", vlvl[3]+2, "Donator");
DOF2_SetInt(string, "LPr", vlvl[2]+2, "Donator");
DOF2_SaveFile();
format(string, sizeof(string), "UniqueIDs/ID_%d.ini", PlayerInfo[hisfuckingid][pUniqueID]);
if(!DOF2_IsSet(string, "A4", "Attachments"))
{
DOF2_SetString(string, "A4", "1 0.00 0.00 0.00 0.00 0.00 0.00 1.00 1.00 1.00", "Attachments");
DOF2_SetInt(string, "S4", -255, "Attachments");
}
DOF2_SetInt(string,"Pdn", 1, "General");
DOF2_SaveFile();
}
case 2:
{
format(string, sizeof(string), "SERVER: You have been made a Silver donator by %s (ID:%d) until %s.", GetPlayerNameEx(playerid), playerid, expire);
SendClientMessage(hisfuckingid, COLOR_WHITE, string);
format(string, sizeof(string), "ADMCMD: You have made %s a Silver donator until %s.", GetPlayerNameEx(hisfuckingid), expire);
SendClientMessage(playerid, COLOR_ADMIN, string);
PlayerInfo[hisfuckingid][pDonator] = dlvl;
PlayerInfo[hisfuckingid][pDonator] = dlvl;
format(string, sizeof(string), "Accounts/%s.ini", GetPlayerNameEx(hisfuckingid));
vlvl[0] = DOF2_GetInt(string, "Rcc", "Donator");
vlvl[1] = DOF2_GetInt(string, "Nmc", "Donator");
vlvl[2] = DOF2_GetInt(string, "LPr", "Donator");
vlvl[3] = DOF2_GetInt(string, "Agc", "Donator");
DOF2_SetInt(string, "Lvl",PlayerInfo[hisfuckingid][pDonator],"Donator");
DOF2_SetString(string, "Exp", expire, "Donator");
DOF2_SetInt(string, "Rcc", vlvl[0]+4, "Donator");
DOF2_SetInt(string, "Nmc", vlvl[1]+4, "Donator");
DOF2_SetInt(string, "Agc", vlvl[3]+4, "Donator");
DOF2_SetInt(string, "LPr", vlvl[2]+4, "Donator");
DOF2_SaveFile();
format(string, sizeof(string), "UniqueIDs/ID_%d.ini", PlayerInfo[hisfuckingid][pUniqueID]);
if(!DOF2_IsSet(string, "A4", "Attachments"))
{
DOF2_SetString(string, "A4", "1 0.00 0.00 0.00 0.00 0.00 0.00 1.00 1.00 1.00", "Attachments");
DOF2_SetInt(string, "S4", -255, "Attachments");
}
if(!DOF2_IsSet(string, "A5", "Attachments"))
{
DOF2_SetString(string, "A5", "1 0.00 0.00 0.00 0.00 0.00 0.00 1.00 1.00 1.00", "Attachments");
DOF2_SetInt(string, "S5", -255, "Attachments");
}
DOF2_SetInt(string,"Pdn", 2, "General");
DOF2_SaveFile();
}
case 3:
{
format(string, sizeof(string), "SERVER: You have been made a Gold donator by %s (ID:%d) until %s.", GetPlayerNameEx(playerid), playerid, expire);
SendClientMessage(hisfuckingid, COLOR_WHITE, string);
format(string, sizeof(string), "ADMCMD: You have made %s a Gold donator until %s.", GetPlayerNameEx(hisfuckingid), expire);
SendClientMessage(playerid, COLOR_ADMIN, string);
PlayerInfo[hisfuckingid][pDonator] = dlvl;
PlayerInfo[hisfuckingid][pDonator] = dlvl;
format(string, sizeof(string), "Accounts/%s.ini", GetPlayerNameEx(hisfuckingid));
vlvl[0] = DOF2_GetInt(string, "Rcc", "Donator");
vlvl[1] = DOF2_GetInt(string, "Nmc", "Donator");
vlvl[2] = DOF2_GetInt(string, "LPr", "Donator");
vlvl[3] = DOF2_GetInt(string, "Agc", "Donator");
DOF2_SetInt(string, "Lvl",PlayerInfo[hisfuckingid][pDonator],"Donator");
DOF2_SetString(string, "Exp", expire, "Donator");
DOF2_SetInt(string, "Rcc", vlvl[0]+8, "Donator");
DOF2_SetInt(string, "Nmc", vlvl[1]+8, "Donator");
DOF2_SetInt(string, "Agc", vlvl[3]+8, "Donator");
DOF2_SetInt(string, "LPr", vlvl[2]+8, "Donator");
DOF2_SaveFile();
format(string, sizeof(string), "UniqueIDs/ID_%d.ini", PlayerInfo[hisfuckingid][pUniqueID]);
if(!DOF2_IsSet(string, "A4", "Attachments"))
{
DOF2_SetString(string, "A4", "1 0.00 0.00 0.00 0.00 0.00 0.00 1.00 1.00 1.00", "Attachments");
DOF2_SetInt(string, "S4", -255, "Attachments");
}
if(!DOF2_IsSet(string, "A5", "Attachments"))
{
DOF2_SetString(string, "A5", "1 0.00 0.00 0.00 0.00 0.00 0.00 1.00 1.00 1.00", "Attachments");
DOF2_SetInt(string, "S5", -255, "Attachments");
}
if(!DOF2_IsSet(string, "A6", "Attachments"))
{
DOF2_SetString(string, "A6", "1 0.00 0.00 0.00 0.00 0.00 0.00 1.00 1.00 1.00", "Attachments");
DOF2_SetInt(string, "S6", -255, "Attachments");
}
DOF2_SetInt(string,"Pdn", 3, "General");
DOF2_SaveFile();
}
default: SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid donator level.");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid player ID.");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: The target is not connected yet.");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot use that command.");
}
}
return 1;
}
PHP код:
CMD:myfuckingdlevel(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
new string[120];
format(string, sizeof(string), "SERVER: Your fucking donating level is %d.", PlayerInfo[playerid][pDonator]);
SendClientMessage(playerid, COLOR_WHITE, string);
}
return 1;
}