19.03.2015, 09:42
Write it like this:
Greekz
PHP код:
new bool:window[MAX_VEHICLES char];
public OnPlayerText(playerid, text[])
{
new v = GetPlayerVehicleID(playerid);
if(v && !IsABike(v)) //So only if he is in a vehicle and its not a bike
{
format(string, sizeof(string), "%s says %s: %s", sendername, (!window{v})?("[Windows Shut]"):("[Windows Down]"),text);
ProxDetector(20.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
return 0;
}
return 1;
}
//if you dont have it:
#define SCM SendClientMessage
//and in the window command:
new v = GetPlayerVehicleID(playerid);
if(!v) return SCM(playerid,-1,"You are not in a vehicle!");
if(IsABike(v)) return SCM(palyerid,-1,"A bike has no windows!");
window{v} = !window{v};
GameTextForPlayer(playerid,(!window{v})?("~r~Window closed"):("~g~Window opened"),5000,5);
return 1;
//Then at the end of the script
stock IsABike(vid)
{
new m = GetVehicleModel(vid);
return (m == 509||m ==510||m ==581||m ==522||m ==521||m ==523||m ==586||m ==481||m ==462||m ==448||m ==461||m ==463||m ==468||m ==471);
}