What is wrong with this ?
#1

Hello, i try to fix this problem if you dont have 500$ it say you dont have the cash for this item, and you need to be gold vip + to buy a gun.

Error:
PHP код:
 error 029invalid expressionassumed zero
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
1 Error

PHP код:
if(listitem == 0)
        {
            if (
GetPlayerCash(playerid) >= 500 && PlayerInfo[playerid][pDonateRank] >= 3)
            {
                
GivePlayerCash(playerid, -500);
                
GivePlayerValidWeapon(playerid2560000);
                
format(stringsizeof(string), "Pumped Shotgun Purchase.");
                
SendClientMessageEx(playeridCOLOR_REDstring);
            }
            else
            {
                
SendClientMessageEx(playeridCOLOR_GRAD4"You don't have the cash for this item!");
            }
this line>>            else
            {
                
SendClientMessageEx(playeridCOLOR_GRAD4"You need to be gold vip +!");
            }
        } 
Reply
#2

You can't have two "else" statements for one "if", give it a thought

if(level > 1)
blabla

else [if level is < 1]
blabla

else [if level is > 1?]
Reply
#3

There are no conditions before the 'else'. You need to edit your message to "You don't have the cash OR you don't have a donate rank fo atleast 3".


Or you need to make a separate condition ('if' statement) for donate rank.
Reply
#4

so like:

PHP код:
if(listitem == 0)
        {
            if (
GetPlayerCash(playerid) >= 500){
            if (
PlayerInfo[playerid][pDonateRank] >= 3)
            {
                
GivePlayerCash(playerid, -500);
                
GivePlayerValidWeapon(playerid2560000);
                
format(stringsizeof(string), "Pumped Shotgun Purchase.");
                
SendClientMessageEx(playeridCOLOR_REDstring);
            }
            else
            {
                
SendClientMessageEx(playeridCOLOR_GRAD4"You don't have the cash for this item!");
            }
            else
            {
                
SendClientMessageEx(playeridCOLOR_GRAD4"You need to be gold vip +!");
            }
        } 
Reply
#5

Try it
Reply
#6

PHP код:
if(listitem == 0)
        {
            if (
GetPlayerCash(playerid) >= 500 || PlayerInfo[playerid][pDonateRank] >= 3) {
                
GivePlayerCash(playerid, -500);
                
GivePlayerValidWeapon(playerid2560000);
                
format(stringsizeof(string), "Pumped Shotgun Purchase.");
                
SendClientMessageEx(playeridCOLOR_REDstring);
            }
            else
            {
               
SendClientMessageEx(playeridCOLOR_GRAD4"You don't have the cash for this item or You need to be gold vip +!");
            }
            
        } 
I suggest you do this
Reply
#7

Quote:
Originally Posted by BladeFire
Посмотреть сообщение
PHP код:
if(listitem == 0)
        {
            if (
GetPlayerCash(playerid) >= 500 || PlayerInfo[playerid][pDonateRank] >= 3) {
                
GivePlayerCash(playerid, -500);
                
GivePlayerValidWeapon(playerid2560000);
                
format(stringsizeof(string), "Pumped Shotgun Purchase.");
                
SendClientMessageEx(playeridCOLOR_REDstring);
            }
            else
            {
               
SendClientMessageEx(playeridCOLOR_GRAD4"You don't have the cash for this item or You need to be gold vip +!");
            }
            
        } 
I suggest you do this
this is not working only for the cash but not for the vip.
Reply
#8

PHP код:
if(listitem == 0)
{
    if(
GetPlayerCash(playerid) < 500) return SendClientMessageEx(playeridCOLOR_GRAD4"You don't have the cash for this item or You need to be gold vip +!");
    if(
PlayerInfo[playerid][pDonateRank] < 3) return SendClientMessageEx(playeridCOLOR_GRAD4"You need to be gold vip +!");
    
GivePlayerCash(playerid, -500);
    
GivePlayerValidWeapon(playerid2560000);
    
format(stringsizeof(string), "Pumped Shotgun Purchase.");
    
SendClientMessageEx(playeridCOLOR_REDstring);

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)