SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 16/06/2019, 04:00 PM   #1
KamilPolska
Huge Clucker
 
Join Date: May 2016
Location: Poland
Posts: 498
Reputation: 5
Default Driving license

Hello. I wanted to remind myself how it's done when getting into a vehicle, it popped up the message that "You do not have a driving license, you decide to leave the vehicle!". How to make it work well?

Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) //test123
{
	if(playerid == vehicleid)
	{
		if(PlayerInfo[playerid][DrivingLicense] == 0)
		{
			SendClientMessage(playerid, -1, "You do not have a driving license, you decide to leave the vehicle!");
			ClearAnimations(playerid);
		}
	}

	return 1;
}
KamilPolska is offline   Reply With Quote
Old 16/06/2019, 04:11 PM   #2
Zipfer247
Little Clucker
 
Join Date: Jun 2019
Posts: 5
Reputation: 0
Default Re: Driving license

Try this. I didn't test it.
pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate){
    if(newstate == PLAYER_STATE_DRIVER){
        if(PlayerInfo[playerid][pDrivingLicense] == 0){
            SendClientMessage(playerid, -1, "You do not have a driving license, you decide to leave the vehicle!");
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Zipfer247 is offline   Reply With Quote
Old 16/06/2019, 04:32 PM   #3
KamilPolska
Huge Clucker
 
Join Date: May 2016
Location: Poland
Posts: 498
Reputation: 5
Default Re: Driving license

Thank you also works nicely.
It works but I'm not sure if this is correct for this public.

Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) //test123
{
	if(vehicleid)
	{
		if(PlayerInfo[playerid][DrivingLicense] == 0)
		{
			SendClientMessage(playerid, -1, "You do not have a driving license, you decide to leave the vehicle!");
        	        ClearAnimations(playerid);
		}
	}

	return 1;
}
Or
Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) //test123
{
	if(PlayerInfo[playerid][DrivingLicense] == 0)
	{
		SendClientMessage(playerid, -1, "You do not have a driving license, you decide to leave the vehicle!");
                ClearAnimations(playerid);
	}

	return 1;
}
KamilPolska is offline   Reply With Quote
Old 16/06/2019, 04:36 PM   #4
Stev
Big Clucker
 
Join Date: Oct 2013
Location: United Kingdom
Posts: 150
Reputation: 17
Default Re: Driving license

They both do the same thing, but I would recommend OnPlayerStateChange
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Stev is offline   Reply With Quote
Old 16/06/2019, 04:41 PM   #5
KamilPolska
Huge Clucker
 
Join Date: May 2016
Location: Poland
Posts: 498
Reputation: 5
Default Re: Driving license

Yes, but OnPlayerEnterVehicle has my plus that it does not get into the vehicle just shows the message by clicking "F" or "Enter". I want to make sure I do not do the wrong thing in OnPlayerEnterVehicle. Later it may happen that it will be bugs.
KamilPolska is offline   Reply With Quote
Old 16/06/2019, 09:02 PM   #6
SiaReyes
Gangsta
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 617
Reputation: 57
Default Re: Driving license

Just Get the player pos and set the player pos!

pawn Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) //test123
{
    if(playerid == vehicleid)
    {
        if(PlayerInfo[playerid][DrivingLicense] == 0)
        {
                     new Float:POS[3];
                    GetPlayerPos(playerid, POS[0], POS[1], POS[2]);
                     SetPlayerPos(playerid, POS[0], POS[1], POS[2]);
            SendClientMessage(playerid, -1, "You do not have a driving license, you decide to leave the vehicle!");
                      return true;
        }
    }

    return 1;
}
SiaReyes is offline   Reply With Quote
Old 16/06/2019, 10:33 PM   #7
KamilPolska
Huge Clucker
 
Join Date: May 2016
Location: Poland
Posts: 498
Reputation: 5
Default Re: Driving license

Oh, that's good for me too. Thanks . What should I do with this " if(playerid == vehicleid) " ?
KamilPolska is offline   Reply With Quote
Old 17/06/2019, 08:12 AM   #8
SiaReyes
Gangsta
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 617
Reputation: 57
Default Re: Driving license

Quote:
Originally Posted by KamilPolska View Post
Oh, that's good for me too. Thanks . What should I do with this " if(playerid == vehicleid) " ?
Remove that if statement!
SiaReyes 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
Driving License Frankin Scripting Help 1 27/01/2015 02:50 PM
[FilterScript] [FS]Driving License nate660 Filterscripts 54 21/09/2013 09:34 AM
[FilterScript] Sgt's Driving License Sascha Filterscripts 19 02/08/2013 10:58 AM
Driving License BaFTa Help Archive 4 04/01/2011 07:45 PM
Driving License SmartCop Help Archive 4 20/09/2010 04:00 PM


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


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