Üdv!
[pawn] #include <a_samp>
#include <zcmd>
#define COLOR_CYAN 0x00FFFFAA
#define COLOR_RED 0xFF0000AA
new safetybelt[MAX_PLAYERS];
public OnFilterScriptInit()
{
print(\"\\n--------------------------------------\");
print(\" SafetyBelt FilterScript:\");
print(\" by DEformers - Andy1210\");
print(\"--------------------------------------\\n\");
return 1;
}
public OnFilterScriptExit()
{
print(\"\\n--------------------------------------\");
print(\" SafetyBelt by Andy1210 UNLOADED\");
print(\"--------------------------------------\\n\");
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
stock GetPlayerSpeed(playerid,bool:kmh) // by misco
{
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)
{
case 448,461,462,463,468,471,509,510,521,522,523,581,586:{
}
default:
{
safetybelt[playerid]=0;
SendClientMessage(playerid, COLOR_CYAN, \"Csatold be a biztonsági övet! \\\"/csat\\\"\");
SendClientMessage(playerid, COLOR_CYAN, \"Ha nem csatolod be, a jármû sérülésekor te is sebzõdsz!\");
}
}
}
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
== 0)
{
if(GetPlayerSpeed(i,true) >= 60)
{
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-1);
}
if(GetPlayerSpeed(i,true) >= 75)
{
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-3);
}
if(GetPlayerSpeed(i,true) >= 85)
{
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-6);
}
if(GetPlayerSpeed(i,true) >= 100)
{
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-12);
}
if(GetPlayerSpeed(i,true) >= 160)
{
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-16);
}
if(GetPlayerSpeed(i,true) >= 180)
{
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-20);
}
if(GetPlayerSpeed(i,true) >= 200)
{
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-30);
}
if(GetPlayerSpeed(i,true) >= 220)
{
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-40);
}
if(GetPlayerSpeed(i,true) >= 250)
{
GetPlayerHealth(i,health);
SetPlayerHealth(i,health-75);
}
}
}
}
return 1;
}
CMD:csat(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_CYAN, \"Ezen a jármûvön nincs biztonsági öv\");
}
default: {
if(safetybelt[playerid] == 0)
{
safetybelt[playerid] = 1;
SendClientMessage(playerid, COLOR_CYAN, \"Becsatoltad a biztonsági övet\");
SendClientMessage(playerid, COLOR_CYAN, \"Az öv kicsatolásához használd a \\\"/csat\\\" parancsot\");
}
else if(safetybelt[playerid] == 1)
{
safetybelt[playerid] = 0;
SendClientMessage(playerid, COLOR_CYAN, \"Kicsatoltad a biztonsági övet\");
SendClientMessage(playerid, COLOR_CYAN, \"Az öv becsatolásához használd a \\\"/csat\\\" parancsot\");
SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)<6?(GetPlayerWantedLevel(playerid)+1):6);
}
}
}
}
return 1;
}
[/pawn]
Ha le akarod tölteni: http://solidfiles.com/d/da1949a975/