error 029: Invalid Expression, Assumed Zero!
#1

I made a command to buy vip for cookies,
here is the code:-

Code:
Код:
COMMAND:cbuyvip(playerid, params[])
{
	if(playerData[playerid][playerLoggedIn])
	{
            if(playerData[playerid][cookies] >=500)
            {
			new
				message2[128]
			;

                        else
		        {
                                playerData[playerid][cookies] = playerData[playerid][cookies] -500;
                                playerData[playerid][playerVIPLevel] = 1;
				playerData[playerid][vipExpires] = gettime() + 2592000;
				playerGiveMoney(playerid, 500000);
				playerGiveXP(playerid, 500);
				
				format(message2, sizeof(message2), "{B7B7B7}[INFO] {FFFFFF}You have bought Standard VIP");
				SendClientMessage(playerid, COLOR_WHITE, message2);

				disableAchieve(playerid);
				PlayerTextDrawShow(playerid, playerData[playerid][Achieve1]);
				PlayerTextDrawShow(playerid, playerData[playerid][Achieve2]);
				PlayerTextDrawShow(playerid, playerData[playerid][Achieve3]);
				PlayerTextDrawShow(playerid, playerData[playerid][Achieve4]);

				PlayerTextDrawSetString(playerid, playerData[playerid][Achieve3], "You're VIP!");
				PlayerTextDrawSetString(playerid, playerData[playerid][Achieve4], "You are now a VIP member, nice!");
				PlayerPlaySound(playerid, 1185 ,0.0, 0.0, 0.0);

				playerData[playerid][achieveTimer] = SetTimerEx("disableAchieve", 6000, false, "i", playerid);

				playerGiveXP(playerid, 25);
				playerData[playerid][playerScore] = playerData[playerid][playerScore] + 2;
				SetPlayerScore(playerid, playerData[playerid][playerScore]);
                }
            }
    }
	return 1;
}
But it is giving error on this line:-

Code:-
Код:
                        else
Plz anyone help, +rep if suceed
Reply
#2

PHP код:
COMMAND:cbuyvip(playeridparams[])
{
    if(
playerData[playerid][playerLoggedIn])
    {
            if(
playerData[playerid][cookies] >=500)
            {
            
               
                                new
                
message2[128];
    
                                
playerData[playerid][cookies] = playerData[playerid][cookies] -500;
                                
playerData[playerid][playerVIPLevel] = 1;
                
playerData[playerid][vipExpires] = gettime() + 2592000;
                
playerGiveMoney(playerid500000);
                
playerGiveXP(playerid500);
                
                
format(message2sizeof(message2), "{B7B7B7}[INFO] {FFFFFF}You have bought Standard VIP");
                
SendClientMessage(playeridCOLOR_WHITEmessage2);
                
disableAchieve(playerid);
                
PlayerTextDrawShow(playeridplayerData[playerid][Achieve1]);
                
PlayerTextDrawShow(playeridplayerData[playerid][Achieve2]);
                
PlayerTextDrawShow(playeridplayerData[playerid][Achieve3]);
                
PlayerTextDrawShow(playeridplayerData[playerid][Achieve4]);
                
PlayerTextDrawSetString(playeridplayerData[playerid][Achieve3], "You're VIP!");
                
PlayerTextDrawSetString(playeridplayerData[playerid][Achieve4], "You are now a VIP member, nice!");
                
PlayerPlaySound(playerid1185 ,0.00.00.0);
                
playerData[playerid][achieveTimer] = SetTimerEx("disableAchieve"6000false"i"playerid);
                
playerGiveXP(playerid25);
                
playerData[playerid][playerScore] = playerData[playerid][playerScore] + 2;
                
SetPlayerScore(playeridplayerData[playerid][playerScore]);
                }
else 
SendClientMessage(playerid, -1"You need to have more than 500 cookies to buy VIP");
            }
                  else 
SendClientMessage(playerid, -1"You are not logged in yet to use any commands");
    }
    return 
1;

Sorry if the code looks messed up, because its edited in Vbulletin Editor xD.
Reply
#3

Remove that line. Why do you have an 'else' statement with no corresponding 'if' statement?
Reply
#4

Quote:
Originally Posted by Zedder
Посмотреть сообщение
PHP код:
COMMAND:cbuyvip(playeridparams[])
{
    if(
playerData[playerid][playerLoggedIn])
    {
            if(
playerData[playerid][cookies] >=500)
            {
            
               
                                new
                
message2[128];
    
                                
playerData[playerid][cookies] = playerData[playerid][cookies] -500;
                                
playerData[playerid][playerVIPLevel] = 1;
                
playerData[playerid][vipExpires] = gettime() + 2592000;
                
playerGiveMoney(playerid500000);
                
playerGiveXP(playerid500);
                
                
format(message2sizeof(message2), "{B7B7B7}[INFO] {FFFFFF}You have bought Standard VIP");
                
SendClientMessage(playeridCOLOR_WHITEmessage2);
                
disableAchieve(playerid);
                
PlayerTextDrawShow(playeridplayerData[playerid][Achieve1]);
                
PlayerTextDrawShow(playeridplayerData[playerid][Achieve2]);
                
PlayerTextDrawShow(playeridplayerData[playerid][Achieve3]);
                
PlayerTextDrawShow(playeridplayerData[playerid][Achieve4]);
                
PlayerTextDrawSetString(playeridplayerData[playerid][Achieve3], "You're VIP!");
                
PlayerTextDrawSetString(playeridplayerData[playerid][Achieve4], "You are now a VIP member, nice!");
                
PlayerPlaySound(playerid1185 ,0.00.00.0);
                
playerData[playerid][achieveTimer] = SetTimerEx("disableAchieve"6000false"i"playerid);
                
playerGiveXP(playerid25);
                
playerData[playerid][playerScore] = playerData[playerid][playerScore] + 2;
                
SetPlayerScore(playeridplayerData[playerid][playerScore]);
                }
else 
SendClientMessage(playerid, -1"You need to have more than 500 cookies to buy VIP");
            }
                  else 
SendClientMessage(playerid, -1"You are not logged in yet to use any commands");
    }
    return 
1;

Sorry if the code looks messed up, because its edited in Vbulletin Editor xD.
Yeah, Worked But Error Jumped To The Second Last Line, Return 1;
Reply
#5

PHP код:
COMMAND:cbuyvip(playeridparams[])
{
    if(!
playerData[playerid][playerLoggedIn]) return   SendClientMessage(playerid, -1"You are not logged in yet to use any commands");
    
            if(
playerData[playerid][cookies] < 500) return SendClientMessage(playerid, -1"You need to have more than 500 cookies to buy VIP");
            
                                new
                
message2[128];
    
                                
playerData[playerid][cookies] = playerData[playerid][cookies] -500;
                                
playerData[playerid][playerVIPLevel] = 1;
                
playerData[playerid][vipExpires] = gettime() + 2592000;
                
playerGiveMoney(playerid500000);
                
playerGiveXP(playerid500);
                
                
format(message2sizeof(message2), "{B7B7B7}[INFO] {FFFFFF}You have bought Standard VIP");
                
SendClientMessage(playeridCOLOR_WHITEmessage2);
                
disableAchieve(playerid);
                
PlayerTextDrawShow(playeridplayerData[playerid][Achieve1]);
                
PlayerTextDrawShow(playeridplayerData[playerid][Achieve2]);
                
PlayerTextDrawShow(playeridplayerData[playerid][Achieve3]);
                
PlayerTextDrawShow(playeridplayerData[playerid][Achieve4]);
                
PlayerTextDrawSetString(playeridplayerData[playerid][Achieve3], "You're VIP!");
                
PlayerTextDrawSetString(playeridplayerData[playerid][Achieve4], "You are now a VIP member, nice!");
                
PlayerPlaySound(playerid1185 ,0.00.00.0);
                
playerData[playerid][achieveTimer] = SetTimerEx("disableAchieve"6000false"i"playerid);
                
playerGiveXP(playerid25);
                
playerData[playerid][playerScore] = playerData[playerid][playerScore] + 2;
                
SetPlayerScore(playeridplayerData[playerid][playerScore]);
    return 
1;

Try now! this is my way of doing it!
Reply
#6

Zeddar Thnx Man, It Worked!!!
+Reped!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)