#include <a_samp>
public OnFilterScriptInit()
{
SetTimer("CheckPlayerPos", 500,true);
print("\n--------------------------------------");
print(" Attach/Deattach Helmet to player");
print(" on bike by wumpyc");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
forward CheckPlayerPos(playerid, vehicleid);
public CheckPlayerPos(playerid, vehicleid)
{
if (IsPlayerInVehicle(playerid,vehicleid) == 522 || IsPlayerInVehicle(playerid, vehicleid) == 509
|| IsPlayerInVehicle(playerid, vehicleid) == 481
|| IsPlayerInVehicle(playerid, vehicleid) == 510
|| IsPlayerInVehicle(playerid, vehicleid) == 462
|| IsPlayerInVehicle(playerid, vehicleid) == 448
|| IsPlayerInVehicle(playerid, vehicleid) == 581
|| IsPlayerInVehicle(playerid, vehicleid) == 461
|| IsPlayerInVehicle(playerid, vehicleid) == 521
|| IsPlayerInVehicle(playerid, vehicleid) == 523
|| IsPlayerInVehicle(playerid, vehicleid) == 463
|| IsPlayerInVehicle(playerid, vehicleid) == 586
|| IsPlayerInVehicle(playerid, vehicleid) == 468
|| IsPlayerInVehicle(playerid, vehicleid) == 471)
SetPlayerAttachedObject(playerid, 1, 18645, 2, 0.07, 0, 0, 88, 75, 0);
return 1;
}
if (
vehicleid == 522 ||
vehicleid == 509 ||
vehicleid == 481 ||
vehicleid == 510 ||
vehicleid == 462 ||
vehicleid == 448 ||
vehicleid == 581 ||
vehicleid == 461 ||
vehicleid == 521 ||
vehicleid == 523 ||
vehicleid == 463 ||
vehicleid == 586 ||
vehicleid == 468 ||
vehicleid == 471
) SetPlayerAttachedObject(playerid, 1, 18645, 2, 0.07, 0, 0, 88, 75, 0);
if (
vehicleid == 522 ||
vehicleid == 509 ||
vehicleid == 481 ||
vehicleid == 510 ||
vehicleid == 462 ||
vehicleid == 448 ||
vehicleid == 581 ||
vehicleid == 461 ||
vehicleid == 521 ||
vehicleid == 523 ||
vehicleid == 463 ||
vehicleid == 586 ||
vehicleid == 468 ||
vehicleid == 471
) RemovePlayerAttachedObject(playerid,1);
Under OnPlayerEnterVehicle
pawn Код:
pawn Код:
|
IsPlayerInVehicle(playerid, vehicleid) == ...
//top of script
new Helmet[MAX_PLAYERS];
public OnPlayerEnterVehicle(playerid,vehicleid,ispassenger)
{
if (GetVehicleModel(vehicleid) == 522 || GetVehicleModel(vehicleid) == 509
|| GetVehicleModel(vehicleid) == 481
|| GetVehicleModel(vehicleid) == 510
|| GetVehicleModel(vehicleid) == 462
|| GetVehicleModel(vehicleid) == 448
|| GetVehicleModel(vehicleid) == 581
|| GetVehicleModel(vehicleid) == 461
|| GetVehicleModel(vehicleid) == 521
|| GetVehicleModel(vehicleid) == 523
|| GetVehicleModel(vehicleid) == 463
|| GetVehicleModel(vehicleid) == 586
|| GetVehicleModel(vehicleid) == 468
|| GetVehicleModel(vehicleid) == 471)
{
Helmet[playerid] = CreateObject(18645,0.0,0.0,0.0,0.0,0.0,0.0,30.0);
AttachObjectToPlayer(Helmet[playerid], playerid, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:rX, Float:rY, Float:rZ);
}
return 1;
}
public OnPlayerExitVehicle(playerid,vehicleid)
{
DestroyObject(Helmet[playerid]);
return 1;
}
yep i wont without any commands...only if you are on bike get helmet else not
|
new Helmet; // Top of code
On GameMode init
Helmet = SetPlayerAttachedObject(playerid, 1, 18645, 2, 0.07, 0, 0, 88, 75, 0);
if (
vehicleid == 522 ||
vehicleid == 509 ||
vehicleid == 481 ||
vehicleid == 510 ||
vehicleid == 462 ||
vehicleid == 448 ||
vehicleid == 581 ||
vehicleid == 461 ||
vehicleid == 521 ||
vehicleid == 523 ||
vehicleid == 463 ||
vehicleid == 586 ||
vehicleid == 468 ||
vehicleid == 471
)
SetPlayerAttachedObject(playerid, helmet, 18645, 2, 0.07, 0, 0, 88, 75, 0);
On Player Exit Vehicle
if (
vehicleid == 522 ||
vehicleid == 509 ||
vehicleid == 481 ||
vehicleid == 510 ||
vehicleid == 462 ||
vehicleid == 448 ||
vehicleid == 581 ||
vehicleid == 461 ||
vehicleid == 521 ||
vehicleid == 523 ||
vehicleid == 463 ||
vehicleid == 586 ||
vehicleid == 468 ||
vehicleid == 471
) RemovePlayerAttachedObject(playerid,helmet);
Ignore him, from my post, it doesn't attaches anything to you when you /seatbelt or /helmet.
And... Maybe you could do pawn Код:
|