Help | OnPlayerEnterVehicle - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help | OnPlayerEnterVehicle (
/showthread.php?tid=126458)
Help | OnPlayerEnterVehicle -
Daniel13145 - 08.02.2010
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?
Re: Help | OnPlayerEnterVehicle -
Daniel13145 - 09.02.2010
please help me guys :\
_________________________________________________
Re: Help | OnPlayerEnterVehicle -
pierhs - 09.02.2010
It doesnt send this message:
Код:
SendClientMessage(playerid, COLOR_WHITE, "--- You can buy this vehicle ---");
because the checkowner is always 1.
Re: Help | OnPlayerEnterVehicle -
Daniel13145 - 09.02.2010
nope, i tried to do
Код:
format(string, sizeof(string), "%s", winner..);
SendClientMessage(playerid, COLOR_WHITE, string);
and its dont send anything.. :\