Megint sziasztok
Van egy övrendszerem. Itt találtam samp-n régebben.
Az a baj vele, hogy motorokon nem mûködik. Mármint az jó, hogy az övet nem lehet a motoron becsatolni, de ha motorra ülök és a falnak megyek 180-200km/h-val akkor semmi nem történik. Remélem tudok segíteni. Köszönöm
Kód:
#include <a_samp>
#include <zcmd>
#define COLOR_GREEN 0x269426AA
#define COLOR_RED 0xFF0000AA
new safetybelt[MAX_PLAYERS];
public OnFilterScriptInit()
{
print(\"\\n--------------------------------------\");
print(\" Övrendszer\");
print(\"--------------------------------------\\n\");
return 1;
}
public OnFilterScriptExit()
{
print(\"\\n--------------------------------------\");
print(\" Övrendszer\");
print(\"--------------------------------------\\n\");
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
stock GetPlayerSpeed(playerid,bool:kmh)
{
new Float:Vx,Float:Vy,Float:Vz,Float:rtn;
if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz); else GetPlayerVelocity(playerid,Vx,Vy,Vz);
rtn = floatsqroot(floatabs(floatpower(Vx + Vy + Vz,2)));
return kmh?floatround(rtn * 100 * 1.61):floatround(rtn * 100);
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
new BikeModel = GetVehicleModel(GetPlayerVehicleID(playerid));
switch(BikeModel)
{
default:
{
safetybelt[playerid]=0;
}
}
}
else if(newstate == PLAYER_STATE_ONFOOT)
{
safetybelt[playerid]=0;
}
return 1;
}
public OnVehicleDamageStatusUpdate(vehicleid,playerid)
{
new Float:health;
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i) && IsPlayerInVehicle(i,vehicleid))
{
if(safetybelt[playerid] == 0)
{
if(GetPlayerSpeed(i,true) >= 60)
{
SetPlayerDrunkLevel (playerid, 2000);
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-1);
}
if(GetPlayerSpeed(i,true) >= 75)
{
SetPlayerDrunkLevel (playerid, 3000);
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-5);
}
if(GetPlayerSpeed(i,true) >= 85)
{
SetPlayerDrunkLevel (playerid, 4000);
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-10);
}
if(GetPlayerSpeed(i,true) >= 100)
{
SetPlayerDrunkLevel (playerid, 5000);
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-15);
}
if(GetPlayerSpeed(i,true) >= 160)
{
SetPlayerDrunkLevel (playerid, 6000);
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-20);
}
if(GetPlayerSpeed(i,true) >= 180)
{
SetPlayerDrunkLevel (playerid, 8000);
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-30);
}
if(GetPlayerSpeed(i,true) >= 200)
{
SetPlayerDrunkLevel (playerid, 12000);
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-35);
}
if(GetPlayerSpeed(i,true) >= 220)
{
SetPlayerDrunkLevel (playerid, 15000);
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-50);
}
if(GetPlayerSpeed(i,true) >= 250)
{
SetPlayerDrunkLevel (playerid, 20000);
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-75);
}
}
if(safetybelt[playerid] == 1)
{
if(GetPlayerSpeed(i,true) >= 60)
{
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-0);
}
if(GetPlayerSpeed(i,true) >= 75)
{
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-2);
}
if(GetPlayerSpeed(i,true) >= 85)
{
SetPlayerDrunkLevel (playerid, 1500);
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-5);
}
if(GetPlayerSpeed(i,true) >= 100)
{
SetPlayerDrunkLevel (playerid, 2500);
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-10);
}
if(GetPlayerSpeed(i,true) >= 160)
{
SetPlayerDrunkLevel (playerid, 4000);
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-15);
}
if(GetPlayerSpeed(i,true) >= 180)
{
SetPlayerDrunkLevel (playerid, 5500);
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-20);
}
if(GetPlayerSpeed(i,true) >= 200)
{
SetPlayerDrunkLevel (playerid, 7500);
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-25);
}
if(GetPlayerSpeed(i,true) >= 220)
{
SetPlayerDrunkLevel (playerid, 9000);
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-30);
}
if(GetPlayerSpeed(i,true) >= 250)
{
SetPlayerDrunkLevel (playerid, 12000);
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-40);
}
}
}
}
return 1;
}
CMD:ov(playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, \"[ Jármûben kell lenned a parancs használatához ]\");
if(IsPlayerInAnyVehicle(playerid))
{
new BikeModel = GetVehicleModel(GetPlayerVehicleID(playerid));
switch(BikeModel)
{
case 448,461,462,463,468,471,509,510,521,522,523,581,586: {
SendClientMessage(playerid, COLOR_RED, \"[ Ezen a jármûvön nincs biztonsági öv ]\");
}
default: {
if(safetybelt[playerid] == 0)
{
safetybelt[playerid] = 1;
SendClientMessage(playerid, COLOR_GREEN, \"[ Becsatoltad a biztonsági övet ]\");
}
else if(safetybelt[playerid] == 1)
{
safetybelt[playerid] = 0;
SendClientMessage(playerid, COLOR_GREEN, \"[ Kicsatoltad a biztonsági övet ]\");
}
}
}
}
return 1;
}