CMD:superspeed(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 5)
{
if(IsPlayerInAnyVehicle(playerid))
{
if (speed[playerid] == 0)
{
SendClientMessage(playerid, COLOR_SUCCESS, "Super Speed has been Enabled !");
speed[playerid] = 1;
}
else if (speed[playerid] == 1)
{
speed[playerid] = 0;
SendClientMessage(playerid, COLOR_FAILED, "Super Speed has been Disabled !");
}
}
else
{
SendClientMessage(playerid, COLOR_CORRECTION, "You are not in a car !");
}
}
else
{
SendClientMessage(playerid, COLOR_CORRECTION, "You are not authorized to use this command !");
}
}
return 1;
}
if(newkeys & KEY_FIRE)
{
if(speed[playerid] == 1)
{
new Float:v[3];
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
GetVehicleVelocity(GetPlayerVehicleID(playerid), v[0],v[1],v[2]);
SetVehicleVelocity(GetPlayerVehicleID(playerid), v[0]*1.8,v[1]*1.8,v[2]*1.8 );
}
}
}
you need this in OnPlayerKeyStateChange, or something, I think there are more ways to make a speed boost.
if(speed[playerid] == 1) { new Float:v[3]; if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { GetVehicleVelocity(GetPlayerVehicleID(playerid), v[0],v[1],v[2]); SetVehicleVelocity(GetPlayerVehicleID(playerid), v[0]*1.8,v[1]*1.8,v[2]*1.8 ); } } |