10.01.2016, 13:06
I don't want to add speed cameras but I have an alternate solution by getting the vehicle speed, if it goes up to 20kmh, the player's money will be deducted by 200. If possible, please help ASAP
//Floats - variables
new Float: x, Float:y, Float:z;
//Get the vehicle speed/velocity
GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
//Now checking the speeds
if(x >= 200)
//Removing $200 from his money & notifying him!
{
GivePlayerMoney(playerid, -200);
SendClientMessage(playerid, -1, "[Speed Limit]: You have crossed the speed limite, therefore, you have been fined $200!");
}
Here is a simple example of it!
PHP код:
|
new Float:vx, Float:vy, Float:vz, Float:vel; vel = GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz); vel = (floatsqroot(((vx*vx)+(vy*vy))+(vz*vz))* 181.5);