/lock command
#1

now in the 0.3 version, how its work?
i know with OnVehicleStreamIn, but it does not work.

my command:

pawn Код:
if (strcmp(cmdtext, "/lock", true) == 0)
  {
  if(IsPlayerInAnyVehicle(playerid))
  {
  new State=GetPlayerState(playerid);
  if(State!=PLAYER_STATE_DRIVER)
  {
  SendClientMessage(playerid,gelb,"You can look the doors only you are the driver.");
  return 1;
  }
  new i;
  for(i=0;i<MAX_PLAYERS;i++)
  {
  if(i != playerid)
  {
  SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
  }
  }
  SendClientMessage(playerid, gelb, "Vehicle look");
  new Float:pX, Float:pY, Float:pZ;
  GetPlayerPos(playerid,pX,pY,pZ);
  PlayerPlaySound(playerid,1056,pX,pY,pZ);
  locked[playerid][GetPlayerVehicleID(playerid)] = 1;
  }
  else
  {
  SendClientMessage(playerid, rot, "You don't are in a Vehicle!");
  }
  return 1;
  }
callback:

pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
  vehid[forplayerid] = vehicleid;
  return 1;
}
Reply
#2

https://sampwiki.blast.hk/wiki/SetVehicleParamsForPlayer
Reply
#3

yes, but lol must I set every car a variable??
Reply
#4

anyone?
Reply
#5

I recommend this script:
http://forum.sa-mp.com/index.php?topic=137706.0
Reply
#6

thanks
Reply
#7

Top of script

pawn Код:
new VehicleLock[MAX_VEHICLES];
In your /lock command

pawn Код:
VehicleLock[GetPlayerVehicleID(playerid)] = 1;
and the callback

pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
  if(VehicleLock[vehicleid] == 1)
  {
    SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, 1);
  }
  return 1;
}
Reply
#8

dont work
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)