SA-MP Forums Archive
Problem with samp 0.3 Car locking - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with samp 0.3 Car locking (/showthread.php?tid=124636)



Problem with samp 0.3 Car locking - hardstop - 31.01.2010


How can i lock certin car for a certin skin Id ?
I tryed like

Код:
if(carid==402)
SendClientMessage(playerid, 0x33AA33AA, "Vehicle locked!");
TogglePlayerControllable(playerid, 0);
	return 1;
}
Just tryed but doesnt work i added under OnPlayerEnterVehicle

How can i lock certin car for certin Skin id please Help if this is possible



Re: Problem with samp 0.3 Car locking - mansonh - 31.01.2010

This will work for car with model 402(buffalo).
The player will lose control as they enter the vehicle.
I assume that is what has happened now.

There are two options for locking a car,
Either

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  if(newstate == PLAYER_STATE_DRIVER)
  {
    new vehicleid = GetPlayerVehicleID(playerid);
    switch(GetVehicleModel(vehicleid))
    {
      case 402:
      {
        SendClientMessage(playerid, 0x33AA33AA, "Vehicle locked!");
        RemovePlayerFromVehicle(playerid);
      }
    }
  }
  return 1;
}
There is also a physical door lock system in samp using:
https://sampwiki.blast.hk/wiki/SetVehicleParamsForPlayer
https://sampwiki.blast.hk/wiki/OnVehicleStreamIn


Re: Problem with samp 0.3 Car locking - hardstop - 31.01.2010

I dont understand where i put Skin ID ?

Buffalo Is locked for Skin id 114 how can i do like that?


Re: Problem with samp 0.3 Car locking - SlashPT - 31.01.2010

well i tested and worked

its under onplayerentervehicle

Код:
if(GetPlayerSkin(playerid) == 114 && vehicleid == 402)
{
	new Float:a,Float:b,Float:c;
	GetPlayerPos(playerid, a,b,c);
	SetPlayerPos(playerid, a,b,c);
	SendClientMessage(playerid, 0xF60000AA, "Vehicle Locked!");
}



Re: Problem with samp 0.3 Car locking - hardstop - 31.01.2010

Oh ty I got it working Ty ty ty


Re: Problem with samp 0.3 Car locking - hardstop - 31.01.2010

Oh my god


When i enter any vehicle when my skin id is 114 all the cars are locked for me


Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  if(GetPlayerSkin(playerid) == 114) // 402 Buffalo car is locked for Skin id 114
	{
	new Float:a,Float:b,Float:c;
	GetPlayerPos(playerid, a,b,c);
	SetPlayerPos(playerid, a,b,c);
	SendClientMessage(playerid, 0xF60000AA, "Vehicle Locked!");
}
	return 1;
}
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
  	{
    new vehicleid = GetPlayerVehicleID(playerid);
    switch(GetVehicleModel(vehicleid))
    {
      case 402:
      {
        SendClientMessage(playerid, 0x33AA33AA, "Vehicle locked!");
        RemovePlayerFromVehicle(playerid);
      }
    }
  }

    if(newstate == PLAYER_STATE_DRIVER)
		{
		  new vehicleid = GetPlayerVehicleID(playerid);
			if(Engine[vehicleid] == 0)
			{
			TogglePlayerControllable(playerid, 0);
			SendClientMessage(playerid, COLOR_YELLOW, "Press (Shift) or Type (/engine) to start the vehicles engine");
			}
			else if(Engine[vehicleid] == 1)
			{
			SendClientMessage(playerid, COLOR_GREEN, "Engine Running...");
			}
}

		return 1;
}



Re: Problem with samp 0.3 Car locking - [HiC]TheKiller - 31.01.2010

Use Mansonh's code.


Re: Problem with samp 0.3 Car locking - SlashPT - 31.01.2010

have you puted this

Код:
if(GetPlayerSkin(playerid) == 114 && vehicleid == 402)
{
	new Float:a,Float:b,Float:c;
	GetPlayerPos(playerid, a,b,c);
	SetPlayerPos(playerid, a,b,c);
	SendClientMessage(playerid, 0xF60000AA, "Vehicle Locked!");
}
and you have to delet all other things you did ...


Re: Problem with samp 0.3 Car locking - hardstop - 31.01.2010

Doesnt work :/


Re: Problem with samp 0.3 Car locking - KuHS - 31.01.2010

I prefer to use SetVehicleParamsForPlayer. https://sampwiki.blast.hk/wiki/SetVehicleParamsForPlayer

Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
  		if(IsPlayerConnected(i))
		{
		  if(GetPlayerSkin(playerid) != 114 && vehicleid == 402) SetVehicleParamsForPlayer(vehicleid, i, 0, 1);
		}
	}
	return 1;
}