/radargun - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /radargun (
/showthread.php?tid=306463)
/radargun -
[LHT]Bally - 26.12.2011
hi all i want to make a radar gun that police only can have , i want it to work off a timer and to be useable by using is player in range of another player i was told.
something like this but needs a timer to be used of 1 second
pawn Код:
stock GetVehicleSpeed(vehicleid)
{
if(vehicleid != INVALID_VEHICLE_ID)
{
new Float:Pos[3],Float:VS ;
GetVehicleVelocity(vehicleid, Pos[0], Pos[1], Pos[2]);
VS = floatsqroot(Pos[0]*Pos[0] + Pos[1]*Pos[1] + Pos[2]*Pos[2])*200;
return floatround(VS,floatround_round);
}
return INVALID_VEHICLE_ID;
}
stock GetPlayerSpeed(playerid)
{
if(playerid != INVALID_PLAYER_ID)
{
new Float:Pos[3],Float:PS;
GetPlayerVelocity(playerid, Pos[0], Pos[1], Pos[2]);
PS = floatsqroot(Pos[0]*Pos[0] + Pos[1]*Pos[1] + Pos[2]*Pos[2])*200;
return floatround(PS,floatround_round);
}
return INVALID_PLAYER_ID;
}
CMD:radargun(playerid,params[])
{
new Float:playerposx,Float:playerposy,Float:playerposz,wantedlevel;
if(ClassPolice && GetPlayerWeapon(playerid) == 43)
{
GetPlayerPos(playerid,playerposx,playerposy,playerposz);
{
if (IsPlayerConnected(playerid))
{
SetTimerEx("radargun",1000,0,"%d",playerid);
if (IsPlayerInRangeOfPoint(playerid,playerposx,playerposy,playerposz,60.0) && GetPlayerSpeed(playerid) <= 120)
{
SetPlayerWantedLevel(playerid,wantedlevel+1);
}
}
}
}
return 1;
}
Re: /radargun -
coole210 - 26.12.2011
Код:
forward radargun(playerid);
public radargun(playerid)
{
new Float:Pos[3];
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i,Pos[0],Pos[1],Pos[2],60.0) && GetPlayerSpeed(playerid) <= 120)
{
SetPlayerWantedLevel(i,(GetPlayerWantedLevel(i)+1));
}
}
return 1;
}
Re: /radargun -
Vlad_Bond - 08.01.2012
I have a script, where you get a camera, and can actually take a picture of a car and it will say it's speed.