invalid expression
#1

Код:
stock StopRefueling(playerid)
{
  new randomCash = random(100);
	new properCash = 0 - randomCash;
	GivePlayerMoney(playerid, properCash);
	SendFormattedMessage(playerid, COLOR_YELLOW,".::[FUEL]: Vehicle Refueled For %d!.", properCash);
	Speed[playerid][Refueling] = 0; KillTimer(Speed[playerid][ReFuelTimer]);
	else {
	SendFormattedMessage(playerid, RED,".::[ERROR]: You Do Not Have Enough Cash TO Refuel Your Vehicle!.", properCash);
	}
	return true;
}
Код:
C:\DOCUME~1\Karim\MYDOCU~1\GRANDT~1\SA-MPS~1\GAMEMO~1\COPSNR~1.PWN(2878) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

pawn Код:
else {
    SendFormattedMessage(playerid, RED,".::[ERROR]: You Do Not Have Enough Cash TO Refuel Your Vehicle!.", properCash);
    }
You can't have a else statement without a if statement
Reply
#3

oo.. so how do i make it if player doesnt have 100 cash or more no refuel for him or her?
Reply
#4

Quote:
Originally Posted by Kar
oo.. so how do i make it if player doesnt have 100 cash or more no refuel for him or her?
pawn Код:
if(GetPlayerMoney(playerid) < 100) return SendFormattedMessage(playerid, RED,".::[ERROR]: You Do Not Have Enough Cash TO Refuel Your Vehicle!.", properCash);
Reply
#5

Код:
C:\DOCUME~1\Karim\MYDOCU~1\GRANDT~1\SA-MPS~1\GAMEMO~1\COPSNR~1.PWN(2878) : error 029: invalid expression, assumed zero
C:\DOCUME~1\Karim\MYDOCU~1\GRANDT~1\SA-MPS~1\GAMEMO~1\COPSNR~1.PWN(2878) : error 036: empty statement
Reply
#6

Quote:
Originally Posted by Carlton
pawn Код:
else {
    SendFormattedMessage(playerid, RED,".::[ERROR]: You Do Not Have Enough Cash TO Refuel Your Vehicle!.", properCash);
    }
You can't have a else statement without a if statement
Lol yes you can

Probably what is giving you that error, is this:

pawn Код:
new properCash = 0 - randomCash;
Reply
#7

Quote:
Originally Posted by _❼_
Quote:
Originally Posted by Carlton
pawn Код:
else {
    SendFormattedMessage(playerid, RED,".::[ERROR]: You Do Not Have Enough Cash TO Refuel Your Vehicle!.", properCash);
    }
You can't have a else statement without a if statement
Lol yes you can

Probably what is giving you that error, is this:

pawn Код:
new properCash = 0 - randomCash;
No you can't. Also
pawn Код:
new properCash = 0 - randomCash;
is not the problem, that's a perfect math code. If I did this:

pawn Код:
public OnPlayerSpawn(playerid) {
   GivePlayerMoney(playerid, 10101010);
   else {
     print("No")
   }
   return 1;
}
It wouldn't work because I have no if statement.
Reply
#8

Код:
new properCash = 0 - randomCash;
its not that

Код:
if(GetPlayerMoney(playerid) < 100) return SendFormattedMessage(playerid, RED,".::[ERROR]: You Do Not Have Enough Cash To Refuel Your Vehicle!.", Vehicle[GetPlayerVehicleID(playerid)][OldFuel]);
giving me 2 errors..
Код:
C:\DOCUME~1\Karim\MYDOCU~1\GRANDT~1\SA-MPS~1\GAMEMO~1\COPSNR~1.PWN(2878) : error 029: invalid expression, assumed zero
C:\DOCUME~1\Karim\MYDOCU~1\GRANDT~1\SA-MPS~1\GAMEMO~1\COPSNR~1.PWN(2878) : error 036: empty statement
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#9

Quote:
Originally Posted by Kar
Код:
new properCash = 0 - randomCash;
its not that

Код:
if(GetPlayerMoney(playerid) < 100) return SendFormattedMessage(playerid, RED,".::[ERROR]: You Do Not Have Enough Cash To Refuel Your Vehicle!.", Vehicle[GetPlayerVehicleID(playerid)][OldFuel]);
giving me 2 errors..
Код:
C:\DOCUME~1\Karim\MYDOCU~1\GRANDT~1\SA-MPS~1\GAMEMO~1\COPSNR~1.PWN(2878) : error 029: invalid expression, assumed zero
C:\DOCUME~1\Karim\MYDOCU~1\GRANDT~1\SA-MPS~1\GAMEMO~1\COPSNR~1.PWN(2878) : error 036: empty statement
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Repost your code with the code I told you to add.
Reply
#10

Oh my bad, I didn't read properly -.-

Yeah, I thought you said "You can't use an else statement like that" or something ... I BLAME THE DRUGS.

pawn Код:
if(GetPlayerMoney(playerid)) < 100) return SendFormattedMessage(playerid, RED,".::[ERROR]: You Do Not Have Enough Cash To Refuel Your Vehicle!.", Vehicle[GetPlayerVehicleID(playerid)][OldFuel]);
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)