24.06.2011, 08:15
Can someone tell me what's wrong here?No compiling errors,simply non-wrokage on game.
pawn Код:
new gBreakDown[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
gBreakDown[playerid] = 0;
return 1;
}
public OnPlayerUpdate(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid) && vehicleid == 437 && GetPlayerSpeed(playerid) > 60 && gBreakDown[playerid] == 0)
{
gBreakDown[playerid] = 1;
SendClientMessage(playerid,COLOR_RED,"A bomb has been planted in your bus and if you slow down below 40 km/h,you'll be blwoed up");
}
if(IsPlayerInAnyVehicle(playerid) && vehicleid == 437 && gBreakDown[playerid] == 1 && GetPlayerSpeed(playerid) < 41)
{
gBreakDown[playerid] = 0;
SendClientMessage(playerid,COLOR_RED,"You didn't obey the rule,BYE BYE!!!");
SetVehicleHealth(vehicleid,0);
}
return 1;
}
stock GetPlayerSpeed(playerid, bool:kmh = true)
{
new
Float:xx,
Float:yy,
Float:zz,
Float:pSpeed;
if(IsPlayerInAnyVehicle(playerid))
{
GetVehicleVelocity(GetPlayerVehicleID(playerid),xx,yy,zz);
}
else
{
GetPlayerVelocity(playerid,xx,yy,zz);
}
pSpeed = floatsqroot((xx * xx) + (yy * yy) + (zz * zz));
return kmh ? floatround((pSpeed * 195.12)) : floatround((pSpeed * 121.9));
}