Helmet script
#1

Anyone know any helmet script when you are on motorbike..or how to it i tried

PHP код:
#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(playeridvehicleid);
public 
CheckPlayerPos(playeridvehicleid)
{
    if (
IsPlayerInVehicle(playerid,vehicleid) == 522 || IsPlayerInVehicle(playeridvehicleid) == 509
    
|| IsPlayerInVehicle(playeridvehicleid) == 481
    
|| IsPlayerInVehicle(playeridvehicleid) == 510
    
|| IsPlayerInVehicle(playeridvehicleid) == 462
    
|| IsPlayerInVehicle(playeridvehicleid) == 448
    
|| IsPlayerInVehicle(playeridvehicleid) == 581
    
|| IsPlayerInVehicle(playeridvehicleid) == 461
    
|| IsPlayerInVehicle(playeridvehicleid) == 521
    
|| IsPlayerInVehicle(playeridvehicleid) == 523
    
|| IsPlayerInVehicle(playeridvehicleid) == 463
    
|| IsPlayerInVehicle(playeridvehicleid) == 586
    
|| IsPlayerInVehicle(playeridvehicleid) == 468
    
|| IsPlayerInVehicle(playeridvehicleid) == 471)
    
SetPlayerAttachedObject(playerid11864520.070088750);
    return 
1;

but doesnt work
Reply
#2

This one is Coo'.

http://forum.sa-mp.com/showthread.ph...ghlight=Helmet
Reply
#3

What he wants is the HELMET, not the RP method ( without helmet display ).
Reply
#4

Under OnPlayerEnterVehicle
pawn Код:
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);
Under OnPlayerExitVehicle
pawn Код:
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);
Reply
#5

Quote:
Originally Posted by hittt
Посмотреть сообщение
Under OnPlayerEnterVehicle
pawn Код:
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);
Under OnPlayerExitVehicle
pawn Код:
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);

that wont work...because you delete it on EXIT in CAR :S...and i already made methog on player enter but i wont when player is on bike or isnt (SetTimer)
Reply
#6

Wait wait... WHAT? Whats wrong with using *PlayerAttachedObject when a player is entering/leaving a car?
Reply
#7

Quote:
Originally Posted by TheMaddox
Посмотреть сообщение
yep i wont without any commands...only if you are on bike get helmet else not
Reply
#8

PHP код:
IsPlayerInVehicle(playeridvehicleid) == ... 
Won't go. Replace IsPlayerInVehicle with GetVehicleModel:

PHP код:
//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], playeridFloat:OffsetXFloat:OffsetYFloat:OffsetZFloat:rXFloat:rYFloat:rZ);
    }
    return 
1;
}
public 
OnPlayerExitVehicle(playerid,vehicleid)
{
    
DestroyObject(Helmet[playerid]);
    return 
1;

I only suggest you to use this under OnPlayerStateChange coz OnPlayerExitVehicle isn't called if you use SetPlayerPos or if he falls off a bike
Reply
#9

Quote:
Originally Posted by wumpyc
Посмотреть сообщение
yep i wont without any commands...only if you are on bike get helmet else not
Ignore him, from my post, it doesn't attaches anything to you when you /seatbelt or /helmet.



And...
Maybe you could do
pawn Код:
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);
Reply
#10

Quote:
Originally Posted by [GOD]Dragonster82
Посмотреть сообщение
Ignore him, from my post, it doesn't attaches anything to you when you /seatbelt or /helmet.



And...
Maybe you could do
pawn Код:
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);
WOn't go since you made only ONE helmet and you destroyed it later. This will fuck up everything coz you have one object for 30+ players and after someone exits vehicle it will be destroyed and it wont be created anymore. Use mine ^^
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)