Hi guys. New question. - 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: Hi guys. New question. (
/showthread.php?tid=358805)
Hi guys. New question. -
PhoeNiX778 - 11.07.2012
One more question guys. I want to make a seatbelt system. I already added a cmd /seatbelt. Here it is
Код:
if(strcmp(cmdtext, "/seatbelt", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
if (!IsNotAEngineCar(idcar))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
if(PlayerInfo[playerid][pMaskUse] == 1) { format(sendername, sizeof(sendername), "Stranger_%d", PlayerInfo[playerid][pRandMask]); }
if(PlayerInfo2[SeatBelt][playerid] == 0)
{
PlayerInfo2[SeatBelt][playerid] = 1;
format(string, sizeof(string), "* %s puts their seatbelt on.", sendername);
}
else if(PlayerInfo2[SeatBelt][playerid] == 1)
{
PlayerInfo2[SeatBelt][playerid] = 0;
format(string, sizeof(string), "* %s takes their seatbelt off.", sendername);
}
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
SendClientMessage(playerid,COLOR_GREY," You are not even inside a vehicle with Seatbelts !");
}
}
else
{
SendClientMessage(playerid,COLOR_GREY," You are not even inside a vehicle !");
}
}
return 1;
}
I would like to make this code working:
Код:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
if(IsPlayerInAnyVehicle(playerid) == 1 && Seatbelt[playerid] == 0)
{
new Float:TempCarHealth;
GetVehicleHealth(GetPlayerVehicleID(playerid), TempCarHealth);
new Float:Difference = floatsub(CarHealth[playerid], TempCarHealth);
if((floatcmp(CarHealth[playerid], TempCarHealth) == 1) && (floatcmp(Difference,100.0) == 1))
{
Difference = floatdiv(Difference, 10.0);
new Float:OldHealth;
GetPlayerHealth(playerid, OldHealth);
SetPlayerHealth(playerid, floatsub(OldHealth, Difference));
}
CarHealth[playerid] = TempCarHealth;
}
else
{
CarHealth[playerid] = 0.0; //To aviod that a player dies when he enters a vehicle
}
return 1;
}
What I should #define or... how to make it work. Thank you all in advance.
Re: Hi guys. New question. -
PhoeNiX778 - 12.07.2012
Can someone make a tutorial, or just a steps how to make it works?
Re: Hi guys. New question. -
_Khaled_ - 12.07.2012
Any compiling error?
Re: Hi guys. New question. -
doreto - 12.07.2012
What actully is the problem ..?
Re: Hi guys. New question. -
God'Z War - 12.07.2012
He was saying He Need The tutorial Of This Topic
Re: Hi guys. New question. -
PhoeNiX778 - 14.07.2012
Can someone help me with this?