08.02.2010, 17:53
Hello,
I did this code:
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?
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;
}
if i dont write the "break" so its general dont work..
why that?

