SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 28/12/2009, 06:21 AM   #1
Studio
Big Clucker
 
Join Date: Mar 2009
Posts: 110
Reputation: 0
Default Instead of a player pressing enter near the vehicle, when your in the vehicle

Hi, when I am trying to make a Cops N robbers server. When I press enter, it prints out "You have commited a crime, stealing a police vehicle." I want it to print that when he is actually in the car.

Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if(gTeam[playerid] >= 3)
	{
		if (IsACopCar(vehicleid) && !ispassenger)
		{
			if(PlayerInfo[playerid][pLeader]==1||PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pLeader]==3) {}
		  else { WantedPoints[playerid]+=2; SetPlayerCriminal(playerid,255, "Stealing A Police Vehicle"); }
		}
		if (IsAnAmbulance(vehicleid) && !ispassenger)
		{
		  if(PlayerInfo[playerid][pMember]==4||PlayerInfo[playerid][pLeader]==4) { }
		  else { WantedPoints[playerid]+=2; SetPlayerCriminal(playerid,255, "Stealing An Ambulance"); }
		}
	}
	return 1;
}
Code:
public IsACopCar(carid)
{
	if((carid >= 35) && (carid <= 60) || (carid >= 134) && (carid <= 166)|| carid == 66 || carid == 67 || carid == 91 || carid == 92 || carid == 93 || carid == 36)
	{
	  if(carid == 45 || carid == 46 || carid == 55 ) { return 0; }
		return 1;
	}
	return 0;
}

public IsAnAmbulance(carid)
{
	if((carid >= 61) && (carid <= 63)|| carid == 83 || carid == 59 || carid == 167 || carid == 86)
	{
		return 1;
	}
	return 0;
}

Thanks, Aleks
Studio is offline  
Old 28/12/2009, 06:22 AM   #2
LVFDM
Little Clucker
 
Join Date: Dec 2009
Posts: 32
Reputation: 0
Default Re: Instead of a player pressing enter near the vehicle, when your in the vehicle

Use OnPlayerStateChange..
LVFDM is offline  
Old 28/12/2009, 06:29 AM   #3
Studio
Big Clucker
 
Join Date: Mar 2009
Posts: 110
Reputation: 0
Default Re: Instead of a player pressing enter near the vehicle, when your in the vehicle

Quote:
Originally Posted by LVFDM
Use OnPlayerStateChange..
So, just paste all onplayerentervehicle into OnPlayerStateChange?
Studio is offline  
Old 28/12/2009, 06:36 AM   #4
Abernethy
Gangsta
 
Join Date: May 2009
Posts: 898
Reputation: -1
Default Re: Instead of a player pressing enter near the vehicle, when your in the vehicle

Use this, then basically the rest of your code inside it.
pawn Code:
if (newstate == PLAYER_STATE_DRIVER || PLAYER_STATE_PASSENGER) {
Abernethy is offline  
Old 28/12/2009, 06:44 AM   #5
Studio
Big Clucker
 
Join Date: Mar 2009
Posts: 110
Reputation: 0
Default Re: Instead of a player pressing enter near the vehicle, when your in the vehicle

C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(1734) : error 004: function "SetPlayerToTeamColor" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(1759) : error 004: function "SetPlayerToTeamColor" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(1779) : error 004: function "SetPlayerCriminal" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(1784) : error 004: function "SetPlayerCriminal" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(184 : error 004: function "PlayerToPoint" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(1852) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(1864) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(186 : error 004: function "PlayerToPoint" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(1872) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(1876) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(1880) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(1884) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(188 : error 004: function "PlayerToPoint" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(1900) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(1904) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(190 : error 004: function "PlayerToPoint" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(1912) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(1916) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(192 : error 004: function "PlayerToPoint" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(1932) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(1936) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(194 : error 004: function "PlayerToPoint" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(1952) : error 004: function "PlayerToPoint" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(2214) : error 004: function "SendIRCMessage" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(2236) : error 004: function "SendIRCMessage" is not implemented
C:\Users\Family\Desktop\Leki Stuff\Copsnrobbers\gamemodes\lol.pwn(224 : error 004: function "SaveCK" is not implemented
Studio is offline  
Old 28/12/2009, 07:22 AM   #6
Dreftas
Gangsta
 
Join Date: May 2008
Posts: 515
Reputation: 0
Default Re: Instead of a player pressing enter near the vehicle, when your in the vehicle

pawn Code:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if (newstate == PLAYER_STATE_DRIVER) {
        if(gTeam[playerid] >= 3){
            if (IsACopCar(GetPlayerVehicleID(playerid)))
            {
                if(PlayerInfo[playerid][pLeader]==1||PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pLeader]==3) {}
                else { WantedPoints[playerid]+=2; SetPlayerCriminal(playerid,255, "Stealing A Police Vehicle"); }
            }
            if (IsAnAmbulance(GetPlayerVehicleID(playerid)))
            {
                if(PlayerInfo[playerid][pMember]==4||PlayerInfo[playerid][pLeader]==4) { }
                else { WantedPoints[playerid]+=2; SetPlayerCriminal(playerid,255, "Stealing An Ambulance"); }
            }
        }
    }
    return 1;
}
Dreftas is offline  
 

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
On Player Enter Vehicle MadnessJohnson Scripting Help 15 05/06/2012 11:41 AM
FS|Vehicle name in enter vehicle and at command lidor5353 Filterscripts 12 25/04/2010 06:56 PM
Help please Rc Vehicle Enter rs2fun111 Help Archive 6 21/12/2009 02:22 PM
on player enter vehicle job help glob1234 Help Archive 3 22/02/2009 07:54 PM


All times are GMT. The time now is 02:25 PM.


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