public OnGameModeInit()
{
//Timer Que chequea el callback
SetTimer("SpeedTrap", 1000, 1);
// Stock
stock Speed(vehicleid)
{
new Float:v_vX, Float:v_vY, Float:v_vZ, Float:retres;
GetVehicleVelocity(vehicleid, v_vX, v_vY, v_vZ);
retres = floatsqroot(floatabs(floatpower(v_vX + v_vY + v_vZ, 2)));
return floatround(retres * 100, floatround_ceil);
}
// CallBack
forward SpeedTrap(playerid,vehicleid)
public SpeedTrap(playerid,vehicleid)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(PlayerToPoint(10.0,playerid,1534.7885,-1682.2577,13.5469))
{
if(Speed(vehicleid) > 20)
{
new string[256]
format(string, sizeof(string), "** HQ: Se ha tomado una foto de un vehiculo a gran velocidad!. **");
SendRadioMessage(1, TEAM_BLUE_COLOR, string);
WantedPoints[playerid]+=2; SetPlayerCriminal(playerid,255, "Velocidad Maxima no respetada!");
SendClientMessage(playerid, COLOR_YELLOW, "Has sido visto por las camaras de velocidad, corre!");
}
}
}
return 1;
}
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
forward SpeedTrap()
public SpeedTrap()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(PlayerToPoint(10.0,playerid,1534.7885,-1682.2577,13.5469))
{
if(Speed(vehicleid) > 20)
{
new string[256]
format(string, sizeof(string), "** HQ: Se ha tomado una foto de un vehiculo a gran velocidad!. **");
SendRadioMessage(1, TEAM_BLUE_COLOR, string);
WantedPoints[playerid]+=2; SetPlayerCriminal(playerid,255, "Velocidad Maxima no respetada!");
SendClientMessage(playerid, COLOR_YELLOW, "Has sido visto por las camaras de velocidad, corre!");
}
}
}
}
return 1;
}
Si no, te dejo este script que capas te sirva: https://sampforum.blast.hk/showthread.php?tid=282180
|