Help | OnPlayerEnterVehicle
#1

Hello,

I did this code:

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  new string[256], playername[100], checkowner = 0;

	// End
	format(string, sizeof(string), "You are entering vehicle %i and the model: %i", vehicleid,   GetVehicleModel(vehicleid));
  SendClientMessage(playerid, 0xFFFFFFFF, string);
  
	for(new i=0; i<=MAX_PLAYERS; i++)
	{
		if(PlayerInfo[i][CarID] == vehicleid)
		{
			checkowner = 1;
			GetPlayerName(i, playername, sizeof(playername));
			break;
		}
	}

	if(checkowner == 1)
	{
		format(string, sizeof(string), "Vehicle occupied by %s", playername);
		SendClientMessage(playerid, COLOR_RED, string);
	}
	else
	{
		SendClientMessage(playerid, COLOR_WHITE, "--- You can buy this vehicle ---");

	}

	return 1;
}
but only if the vehicle have owner he send the message "Vehicle occupied by ..." but if no one have the vehicle so he dont send anything.

if i dont write the "break" so its general dont work..
why that?
Reply


Messages In This Thread
Help | OnPlayerEnterVehicle - by Daniel13145 - 08.02.2010, 17:53
Re: Help | OnPlayerEnterVehicle - by Daniel13145 - 09.02.2010, 11:57
Re: Help | OnPlayerEnterVehicle - by pierhs - 09.02.2010, 12:22
Re: Help | OnPlayerEnterVehicle - by Daniel13145 - 09.02.2010, 12:27

Forum Jump:


Users browsing this thread: 1 Guest(s)