SA-MP Forums Archive
question about return - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: question about return (/showthread.php?tid=460186)



question about return - omidi - 27.08.2013

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;
}



Re: question about return - Finn707 - 27.08.2013

Yeah, you do need them.


Re: question about return - JaKe Elite - 27.08.2013

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!
}