SA-MP Forums Archive
Please help out - 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: Please help out (/showthread.php?tid=129991)



Please help out - prointercepter - 24.02.2010

Im new and my friend gave me this cool code it works but everyone can use it
I need only skin 120 to be able to use them
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (HOLDING(KEY_CROUCH))
{
if(IsPlayerInRangeOfPoint(playerid,10.0,213.8026,1 876.0151,13.1406))
{
MoveObject(fronthqgate, 226.2012,1875.1792,13.8000, 2.00);
}
}

if (RELEASED(KEY_CROUCH))
{
MoveObject(fronthqgate, 214.2012,1875.1792,13.8000, 2.00);
}

if (HOLDING(KEY_SUBMISSION))
{
LinkVehicleToInterior(GetPlayerVehicleID(playerid) , 1);
}

if (RELEASED(KEY_SUBMISSION))
{
LinkVehicleToInterior(GetPlayerVehicleID(playerid) , 0);
}
return 1;
}
Please help


Re: Please help out - Joe Staff - 24.02.2010

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  if(GetPlayerSkin(playerid)==120)
  {
    if (HOLDING(KEY_CROUCH))
    {
      if(IsPlayerInRangeOfPoint(playerid,10.0,213.8026,1876.0151,13.1406))
      {
        MoveObject(fronthqgate, 226.2012,1875.1792,13.8000, 2.00);
      }
    }

    if (RELEASED(KEY_CROUCH))
    {
      MoveObject(fronthqgate, 214.2012,1875.1792,13.8000, 2.00);
    }

    if (HOLDING(KEY_SUBMISSION))
    {
      LinkVehicleToInterior(GetPlayerVehicleID(playerid), 1);
    }

    if (RELEASED(KEY_SUBMISSION))
    {
      LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
    }
  }
  return 1;
}



Re: Please help out - MenaceX^ - 24.02.2010

Quote:
Originally Posted by Joe Staff
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  if(GetPlayerSkin(playerid)==120)
  {
    if (HOLDING(KEY_CROUCH))
    {
      if(IsPlayerInRangeOfPoint(playerid,10.0,213.8026,1876.0151,13.1406))
      {
        MoveObject(fronthqgate, 226.2012,1875.1792,13.8000, 2.00);
      }
    }

    if (RELEASED(KEY_CROUCH))
    {
      MoveObject(fronthqgate, 214.2012,1875.1792,13.8000, 2.00);
    }

    if (HOLDING(KEY_SUBMISSION))
    {
      LinkVehicleToInterior(GetPlayerVehicleID(playerid), 1);
    }

    if (RELEASED(KEY_SUBMISSION))
    {
      LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
    }
  }
  return 1;
}
I would rather do
pawn Код:
if (HOLDING(KEY_CROUCH)&&GetPlayerSkin(playerid)==120)



Re: Please help out - Joe Staff - 24.02.2010

But then you're checking multiple times for each different key (he has multiple key commands there)


Re: Please help out - aircombat - 24.02.2010

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  new Skin;
  Skin = GetPlayerSkin(playerid);
  if(Skin == 120)
  {
    if (HOLDING(KEY_CROUCH))
    {
      if(IsPlayerInRangeOfPoint(playerid,10.0,213.8026,1876.0151,13.1406))
      {
        MoveObject(fronthqgate, 226.2012,1875.1792,13.8000, 2.00);
      }
    }

    if (RELEASED(KEY_CROUCH))
    {
      MoveObject(fronthqgate, 214.2012,1875.1792,13.8000, 2.00);
    }

    if (HOLDING(KEY_SUBMISSION))
    {
      LinkVehicleToInterior(GetPlayerVehicleID(playerid), 1);
    }

    if (RELEASED(KEY_SUBMISSION))
    {
      LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
    }
  }
  return 1;
}
________
Sick from depakote


Re: Please help out - prointercepter - 24.02.2010

Update
I used the first code