A small problem!!!
#1

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));
}
Reply
#2

Anyone?
Reply
#3

to check for the vehicle types (id), you need the GetVehicleModel(vehicleid) , maybe you need to include a GetVehicleSpeed?
Код:
public OnPlayerUpdate(playerid)
{
	new vehicleid = GetPlayerVehicleID(playerid);
	new modelid= GetVehicleModel(vehicleid);
	if(IsPlayerInAnyVehicle(playerid) && modelid == 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 blowed up");
	}
	if(IsPlayerInAnyVehicle(playerid) && modelid == 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;
}
Reply
#4

Nope,still not working,any other sugesstions(I tried this a few months ago and I saw it's not working BUT THIS TIME I WON'T GIVE UP)?
Reply
#5

What's the problem?I changed GetPlayerVehicleID with GetVehicleModel and still not working?
Reply
#6

GetVehicleModel(GetPlayerVehicleID(playerid));

Also you do not need to call IsPlayerInAnyVehicle if you already retrieved the vehicleid.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)