SA-MP Forums Archive
I can not get in the car - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: I can not get in the car (/showthread.php?tid=566696)



I can not get in the car - radiobizza - 07.03.2015

I want to add some cars to a certain faction and when I walk into play pushes me out of the car automatically.
I do not know how to make them.
PHP код:
        new idcar GetPlayerVehicleID(playerid);
        if(
IsGovermentCar(idcar))
        {
              if(
GetPVarInt(playerid"Member") == 3)
              {
                
SendClientMessage(playeridCOLOR_WHITE"Test");
                
PutPlayerInVehicle(playerididcar,0);
              }
            else
            {
                
SendClientMessage(playeridCOLOR_WHITE"Nu esti membru al guvernului !");
            }
        } 



Re: I can not get in the car - X337 - 08.03.2015

Use RemovePlayerFromVehicle
example :
Код:
new idcar = GetPlayerVehicleID(playerid); 
        if(IsGovermentCar(idcar)) 
        { 
              if(GetPVarInt(playerid, "Member") == 3) 
              { 
                SendClientMessage(playerid, COLOR_WHITE, "Test"); 
                PutPlayerInVehicle(playerid, idcar,0); 
              } 
            else 
            { 
                SendClientMessage(playerid, COLOR_WHITE, "Nu esti membru al guvernului !"); 
                RemovePlayerFromVehicle(playerid);
            } 
        }



Re: I can not get in the car - radiobizza - 08.03.2015

don't work..


Re: I can not get in the car - Zonoya - 08.03.2015

If this is OnPlayerEnterVehicle, you can use this code:

Код:
ClearAnimations(playerid,1);
To clear the animation of entering the vehicle, this, essentially, stops a player from entering a vehicle if you don't want them too, heres an example of it from my house and car script I'm coding:

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	new pName[24];
	GetPlayerName(playerid,pName,24);
	if(vData[vehicleid][vPublic] == 0 && strcmp(vData[vehicleid][vOwner],pName) == 0 && ispassenger == 0 && vData[vehicleid][vLocked] == 1) {
		ClearAnimations(playerid,1);
		SendClientMessage(playerid,-1,"This isn't your car!");
		return 0;
	}
	return 1;
}
It also has other uses, as it clears every animation in progress when called, I believe that is what you want though.


Re: I can not get in the car - radiobizza - 10.03.2015

don't work.. )


Re: I can not get in the car - Evocator - 10.03.2015

Use OnPlayerStateChange and RemovePlayerFromVehicle.

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
	{
		new idcar = GetPlayerVehicleID(playerid); 
	    if(IsGovermentCar(idcar)) 
	    { 
	      	if(GetPVarInt(playerid, "Member") == 3) 
	     	{ 
	     		SendClientMessage(playerid, COLOR_WHITE, "Test"); 
	   		} 
	        else 
	        { 
	            SendClientMessage(playerid, COLOR_WHITE, "Nu esti membru al guvernului !"); 
	            RemovePlayerFromVehicle(playerid);
	        } 
	    }
	}
return 1;
}



Re: I can not get in the car - radiobizza - 19.03.2015

still don't working..


AW: Re: I can not get in the car - Kaliber - 19.03.2015

Quote:
Originally Posted by radiobizza
Посмотреть сообщение
still don't working..
Then..post the function IsGovermentCar, how you create the vehicles and what your current Code looks like