#1

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)

PHP код:
CMD:makedonator(playeridparams[])
{
    if(
IsPlayerConnected(playerid))
    {
        new 
hisfuckingid;
        new 
dlvl;
        new 
vlvl[7];
        new 
expire[11];
        if(
sscanf(params"rds[11]"hisfuckingiddlvlexpire))
        {
            
SendClientMessage(playeridCOLOR_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(stringsizeof(string), "SERVER: Your donator status has been revoked by %s."GetPlayerNameEx(playerid));
                            
SendClientMessage(hisfuckingidCOLOR_WHITEstring);
                            
format(stringsizeof(string),"ADMCMD: You have revoked %s's donator status."GetPlayerNameEx(hisfuckingid));
                            
SendClientMessage(playeridCOLOR_ADMINstring);
                            
PlayerInfo[hisfuckingid][pDonator] = dlvl;
                            
PlayerInfo[hisfuckingid][pDonator] = dlvl;
                            
format(stringsizeof(string), "Accounts/%s.ini"GetPlayerNameEx(hisfuckingid));
                            
DOF2_SetInt(string"Lvl",PlayerInfo[hisfuckingid][pDonator], "Donator");
                            
DOF2_Unset(string"Exp""Donator");
                            
DOF2_SaveFile();
                        }
                        case 
1:
                        {
                            
format(stringsizeof(string), "SERVER: You have been made a Bronze donator by %s (ID:%d) until %s."GetPlayerNameEx(playerid), playeridexpire);
                            
SendClientMessage(hisfuckingidCOLOR_WHITEstring);
                            
format(stringsizeof(string), "ADMCMD: You have made %s a Bronze donator until %s."GetPlayerNameEx(hisfuckingid), expire);
                            
SendClientMessage(playeridCOLOR_ADMINstring);
                            
PlayerInfo[hisfuckingid][pDonator] = dlvl;
                            
PlayerInfo[hisfuckingid][pDonator] = dlvl;
                            
format(stringsizeof(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(stringsizeof(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(stringsizeof(string), "SERVER: You have been made a Silver donator by %s (ID:%d) until %s."GetPlayerNameEx(playerid), playeridexpire);
                            
SendClientMessage(hisfuckingidCOLOR_WHITEstring);
                            
format(stringsizeof(string), "ADMCMD: You have made %s a Silver donator until %s."GetPlayerNameEx(hisfuckingid), expire);
                            
SendClientMessage(playeridCOLOR_ADMINstring);
                            
PlayerInfo[hisfuckingid][pDonator] = dlvl;
                            
PlayerInfo[hisfuckingid][pDonator] = dlvl;
                            
format(stringsizeof(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(stringsizeof(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(stringsizeof(string), "SERVER: You have been made a Gold donator by %s (ID:%d) until %s."GetPlayerNameEx(playerid), playeridexpire);
                            
SendClientMessage(hisfuckingidCOLOR_WHITEstring);
                            
format(stringsizeof(string), "ADMCMD: You have made %s a Gold donator until %s."GetPlayerNameEx(hisfuckingid), expire);
                            
SendClientMessage(playeridCOLOR_ADMINstring);
                            
PlayerInfo[hisfuckingid][pDonator] = dlvl;
                            
PlayerInfo[hisfuckingid][pDonator] = dlvl;
                            
format(stringsizeof(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(stringsizeof(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(playeridCOLOR_RED"ERROR: Invalid donator level.");
                       }
                   }
                   else
                   {
                    
SendClientMessage(playeridCOLOR_RED"ERROR: Invalid player ID.");
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_RED"ERROR: The target is not connected yet.");
            }
        }
        else
        {
            
SendClientMessage(playeridCOLOR_RED"ERROR: You cannot use that command.");
        }
    }
    return 
1;

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.

PHP код:
CMD:myfuckingdlevel(playeridparams[])
{
    if(
IsPlayerConnected(playerid))
    {
        new 
string[120];
        
format(stringsizeof(string), "SERVER: Your fucking donating level is %d."PlayerInfo[playerid][pDonator]);
        
SendClientMessage(playeridCOLOR_WHITEstring);
    }
    return 
1;

It's always showing that I'm a level 1 donator.. lol
Reply
#2

Try this code.

Код:
CMD:makedonator(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1336)
		return SendClientMessage(playerid, COLOR_RED, "ERROR: You can't use that command!");

	new
	targetid,
	donatorlvl,
	vlvl[7],
	donatorexpire[11];

	if(sscanf(params, "rds[11]", targetid, donatorlvl, donatorexpire))
		return SendClientMessage(playerid, COLOR_GREY, "USAGE: /makedonator [playerid] [level] [ExpirationDate]");

	if(!IsPlayerConnected(targetid))
		return SendClientMessage(playerid, COLOR_RED, "ERROR: The player is not connected.");

	if(targetid == INVALID_PLAYER_ID)
		return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid playerid.");

	if(donatorlvl < 0 || donatorlvl > 3)
		return SendClientMessage(playerid, COLOR_RED, "ERROR: Valid Donator levels are 0 (revoke) to 3.");

	new string[150];

	if(donatorlvl == 0)
	{
        format(string, sizeof(string), "SERVER: Your donator status has been revoked by %s.", GetPlayerNameEx(playerid)); 
        SendClientMessage(targetid, COLOR_WHITE, string); 
        format(string, sizeof(string),"ADMCMD: You have revoked %s's donator status.", GetPlayerNameEx(targetid)); 
        SendClientMessage(playerid, COLOR_ADMIN, string); 
        PlayerInfo[targetid][pDonator] = donatorlvl; 
        PlayerInfo[targetid][pDonator] = donatorlvl; 
        format(string, sizeof(string), "Accounts/%s.ini", GetPlayerNameEx(targetid)); 
        DOF2_SetInt(string, "Lvl",PlayerInfo[targetid][pDonator], "Donator"); 
        DOF2_Unset(string, "Exp", "Donator"); 
        DOF2_SaveFile(); 
	}
	else if(donatorlvl == 1)
	{
	    format(string, sizeof(string), "SERVER: You have been made a Bronze donator by %s (ID:%d) until %s.", GetPlayerNameEx(playerid), playerid, donatorexpire); 
        SendClientMessage(targetid, COLOR_WHITE, string); 
        format(string, sizeof(string), "ADMCMD: You have made %s a Bronze donator until %s.", GetPlayerNameEx(targetid), donatorexpire); 
        SendClientMessage(playerid, COLOR_ADMIN, string); 
        PlayerInfo[targetid][pDonator] = donatorlvl; 
        PlayerInfo[targetid][pDonator] = donatorlvl; 
        format(string, sizeof(string), "Accounts/%s.ini", GetPlayerNameEx(targetid)); 
        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[targetid][pDonator],"Donator"); 
        DOF2_SetString(string, "Exp", donatorexpire, "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[targetid][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(); 		
	}
	else if(donatorlvl == 2)
	{
		format(string, sizeof(string), "SERVER: You have been made a Silver donator by %s (ID:%d) until %s.", GetPlayerNameEx(playerid), playerid, donatorexpire); 
        SendClientMessage(targetid, COLOR_WHITE, string); 
        format(string, sizeof(string), "ADMCMD: You have made %s a Silver donator until %s.", GetPlayerNameEx(targetid), donatorexpire); 
        SendClientMessage(playerid, COLOR_ADMIN, string); 
        PlayerInfo[targetid][pDonator] = donatorlvl; 
        PlayerInfo[targetid][pDonator] = donatorlvl; 
        format(string, sizeof(string), "Accounts/%s.ini", GetPlayerNameEx(targetid)); 
        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[targetid][pDonator],"Donator"); 
        DOF2_SetString(string, "Exp", donatorexpire, "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[targetid][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(); 
	}
	else if(donatorlvl == 3)
	{
	    format(string, sizeof(string), "SERVER: You have been made a Gold donator by %s (ID:%d) until %s.", GetPlayerNameEx(playerid), playerid, donatorexpire); 
        SendClientMessage(targetid, COLOR_WHITE, string); 
        format(string, sizeof(string), "ADMCMD: You have made %s a Gold donator until %s.", GetPlayerNameEx(targetid), donatorexpire); 
        SendClientMessage(playerid, COLOR_ADMIN, string); 
        PlayerInfo[targetid][pDonator] = donatorlvl; 
        PlayerInfo[targetid][pDonator] = donatorlvl; 
        format(string, sizeof(string), "Accounts/%s.ini", GetPlayerNameEx(targetid)); 
        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[targetid][pDonator],"Donator"); 
        DOF2_SetString(string, "Exp", donatorexpire, "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[targetid][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(); 
	}
	return 1;
}
Reply
#3

Quote:
Originally Posted by Sabur
Посмотреть сообщение
Try this code.
Well Now It's always 0.
Reply
#4

Maybe your sscanf problem :
PHP код:
if(sscanf(params"rds[11]"hisfuckingiddlvlexpire)) 
Change to this :
PHP код:
if(sscanf(params"iis[11]"hisfuckingiddlvlexpire)) 
Or This :
PHP код:
if(sscanf(params"uds[11]"hisfuckingiddlvlexpire)) 
Reply
#5

Quote:
Originally Posted by haikalbintang
Посмотреть сообщение
Maybe your sscanf problem :
PHP код:
if(sscanf(params"rds[11]"hisfuckingiddlvlexpire)) 
Change to this :
PHP код:
if(sscanf(params"iis[11]"hisfuckingiddlvlexpire)) 
Or This :
PHP код:
if(sscanf(params"uds[11]"hisfuckingiddlvlexpire)) 
Same.. It's not going more than 1..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)