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
#2

please help me guys :\
_________________________________________________
Reply
#3

It doesnt send this message:
Код:
SendClientMessage(playerid, COLOR_WHITE, "--- You can buy this vehicle ---");
because the checkowner is always 1.
Reply
#4

nope, i tried to do
Код:
format(string, sizeof(string), "%s", winner..);
SendClientMessage(playerid, COLOR_WHITE, string);
and its dont send anything.. :\
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)