[help] else function
#1

can anyone tell me why i get this compile error (return 1; line)
Код:
C:\Documents and Settings\Chris\Desktop\Stunt City\gamemodes\NewServer.pwn(566) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Heres my code:
Код:
    if (pickupid == who)
    {
        new pname[24], string[128];
        GetPlayerName(playerid, pname, sizeof(pname));
        format(string, sizeof(string), "%s has just purchased MR.Whoopey fleet of vehicles.", pname);
        SendClientMessageToAll(0x33AA33AA, string);
        SendClientMessage(playerid, 0xFFA500AA, "Better go serve some ice cream!.");
        GivePlayerMoney(playerid, -1000);
        }
       	else
       	SendClientMessage(playerid, 0xFFA500AA, "You dont have enough cash for this price: $1000");
    }
        return 1;
}
Reply
#2

The else statement wouldn't work because there is no if statement in there to check the player's cash, you need to check if the player has enough money if you want to put something if they don't.

pawn Код:
if (pickupid == who)
    {
   
            if (GetPlayerMoney(playerid) >= 1000) // if player has $1000+
            {
                new pname[24], string[128];
                GetPlayerName(playerid, pname, sizeof(pname));
                format(string, sizeof(string), "%s has just purchased MR.Whoopey fleet of vehicles.", pname);
                SendClientMessageToAll(0x33AA33AA, string);
                SendClientMessage(playerid, 0xFFA500AA, "Better go serve some ice cream!.");
                GivePlayerMoney(playerid, -1000);
            }
            else
            {
                SendClientMessage(playerid, 0xFFA500AA, "You dont have enough cash for this price: $1000");
            }

      }
Reply
#3

iy dosen't work cuz you fotgot the '{' after the else
Reply
#4

hey, the error is on return 1; line
Reply
#5

cuz u forgot the '{' after thye else
Reply
#6

hey hustler i get this error on return 1

Код:
C:\Documents and Settings\Chris\Desktop\Stunt City\gamemodes\NewServer.pwn(572) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Код:
    }
    return 1;
}
Reply
#7

Its not an error, its a warning, just hit backspace on that line until it disappears
Reply
#8

indentation = amount of times your script is indented in our out (using tab + backspace)
when you get a indentation error try indenting it with tab a couple of times or taking it back using backspace
hope that made sense


off : hai mlk
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)