question about return
#1

do i need put return to this if statement ?

Код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
	if(CheckPoint[playerid] ==1)
	{
		 if(!IsPlayerInAnyVehicle(playerid))
			return SendClientMessage(playerid,COLOR_LIGHTBLUE,"U must be in car");
			CheckPoint[playerid] =2;
		return 1; // do i need to put this ?
	}
	
	if(CheckPoint[playerid] ==2)
	{
		SendClientMessage(playerid,COLOR_LIGHTBLUE,"U are In CheckjPoitn 2");
		CheckPoint[playerid] =3;
		return 1;  //  do i need to put this ?
	}
	if(CheckPoint[playerid] ==3)
	{
		SendClientMessage(playerid,COLOR_LIGHTBLUE,"U are In CheckjPoitn 3");
		CheckPoint[playerid] =4;	
		return 1;  //  do i need to put this ?
	}
	return 1;
}
Reply
#2

Yeah, you do need them.
Reply
#3

Yes, but you could do this in more stable and efficient way. Switch.

For ex.

pawn Код:
switch(Cake[playerid])
{
case 0: //no cake for you
case 1: //cake for you yay!
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)