SA:MP Passenger shooting from car (By H) fix?
#1

Hello guys, I'm making script to resolve the bugs by script way for passenger shooting.

Story: When you sit to car as passenger and you have chosen weapon (e.g. ak, m4, colt, tec..) and you press H you can shoot out of car. But when you press F (Enter) there are 2 thing that'll happen.

a) You will jump out from vehicle-I've already fixed that

b) Sometimes you won't leave vehicle BUT when you press H again you won't be able to shoot from H. That's my issue.. I want to fix that..
Any ideas, tips, trick, etc.. I will be grateful for any answers!
Reply
#2

I'm not entirely sure, but perhaps try ClearAnimations. It seems to work for a similar bug in fixes.inc.
Reply
#3

Thanks for tip:

I've tried that as first thing, but sadly didn't work it puts player to top of car, as wiki says:
https://sampwiki.blast.hk/wiki/ClearAnimations
Reply
#4

Do you mean the one that will move the player away from the window like they have just entered?

If it's possible to detect whether a player is passenger and presses H (not sure if it's called when a player drive-by), then setting a variable to true and if it's pressed again and the variable is true, re-put the player in the vehicle might be a possible solution.
Reply
#5

I will do some testing and get back to you.
Reply
#6

@Konstantinos

I've done detection when player drives by as passenger from car window by H variables are more likely done. And yes that reputting I have too, but I made it for OnPlayerExitVehicle, that means it gets called only when after player press F (Enter) he jump off vehicle. But I need to detect whenever the player won't leave vehicle he gets back, but he he can't use H again.
Reply
#7

If it detects the pressing of H without any problems when a passenger drive-by, then you got it already done with the way I said. The first time the player presses H, set it to true. If the player presses H again and it's true, re-put in vehicle and set to false.
Reply
#8

Yeah, I understand you, but after reput player can't driveby by using H again, until he reenter car.
Reply
#9

I don't understand you but you need to try this:

PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        
SetPlayerArmedWeapon(playerid0);
    }
    if(
oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_PASSENGER)
    {
        
SetPlayerArmedWeapon(playerid0);
    }
    return 
1;

When player enter in vehicle as driver or passenger, it select his weapon to 0 (Don't reset, just select) and he cannot shot.
Reply
#10

I did quite a bit of testing and came up with this:

http://pastebin.com/QBfQ0jG8

Works perfectly. Tested it a LOT. Please let me know if it works fine for you.

I will add it to fixes.inc when I have time. At the minute fixes.inc just makes it so if you press H again you cancel the drive-by.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)