SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 06/05/2015, 02:26 PM   #1
Riwerry
Huge Clucker
 
Join Date: Oct 2013
Posts: 413
Reputation: 3
Default SA:MP Passenger shooting from car (By H) fix?

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!
Riwerry is offline   Reply With Quote
Old 06/05/2015, 02:30 PM   #2
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,422
Reputation: 973
Default Re: SA:MP Passenger shooting from car (By H) fix?

I'm not entirely sure, but perhaps try ClearAnimations. It seems to work for a similar bug in fixes.inc.
MP2 is offline   Reply With Quote
Old 06/05/2015, 02:36 PM   #3
Riwerry
Huge Clucker
 
Join Date: Oct 2013
Posts: 413
Reputation: 3
Default Re: SA:MP Passenger shooting from car (By H) fix?

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://wiki.sa-mp.com/wiki/ClearAnimations
Riwerry is offline   Reply With Quote
Old 06/05/2015, 02:36 PM   #4
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,990
Reputation: 1392
Default Re: SA:MP Passenger shooting from car (By H) fix?

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.
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 06/05/2015, 02:38 PM   #5
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,422
Reputation: 973
Default Re: SA:MP Passenger shooting from car (By H) fix?

I will do some testing and get back to you.
MP2 is offline   Reply With Quote
Old 06/05/2015, 02:39 PM   #6
Riwerry
Huge Clucker
 
Join Date: Oct 2013
Posts: 413
Reputation: 3
Default Re: SA:MP Passenger shooting from car (By H) fix?

@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.
Riwerry is offline   Reply With Quote
Old 06/05/2015, 02:48 PM   #7
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,990
Reputation: 1392
Default Re: SA:MP Passenger shooting from car (By H) fix?

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.
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 06/05/2015, 02:49 PM   #8
Riwerry
Huge Clucker
 
Join Date: Oct 2013
Posts: 413
Reputation: 3
Default Re: SA:MP Passenger shooting from car (By H) fix?

Yeah, I understand you, but after reput player can't driveby by using H again, until he reenter car.
Riwerry is offline   Reply With Quote
Old 06/05/2015, 03:17 PM   #9
DarkLouis
Big Clucker
 
Join Date: Jan 2014
Location: Italy
Posts: 150
Reputation: 5
Default Re: SA:MP Passenger shooting from car (By H) fix?

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

PHP Code:
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.
DarkLouis is offline   Reply With Quote
Old 06/05/2015, 03:23 PM   #10
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,422
Reputation: 973
Default Re: SA:MP Passenger shooting from car (By H) fix?

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.
MP2 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help, Shooting from a car as passenger. Kenzix Scripting Help 5 18/03/2014 07:42 PM
Passenger help yancarlos4500 Scripting Help 2 22/07/2013 11:41 PM
Car Passenger does not TP with. Stefand Scripting Help 4 18/06/2013 08:45 AM
get passenger name? falor Help Archive 2 23/04/2010 03:14 PM


All times are GMT. The time now is 06:05 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.