SA-MP Forums Archive
fail... :O - 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: fail... :O (/showthread.php?tid=122605)



fail... :O - `FuTuRe- - 22.01.2010

The problem is.. when someone leaves any vehicle it notifys that, and it only needs to notify it for the defined vehicles. (PLANE_LS) Etc.

pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    new playervehicleid = GetPlayerVehicleID(playerid);
  new string[256]; new playername[MAX_PLAYER_NAME];
  GetPlayerName (playerid, playername, sizeof(playername));

  if(playervehicleid == PLANE_LS || PLANE_SF || PLANE_LS2 || PLANE_SF2 && GetPlayerTeam(playerid) == TEAM_LS || TEAM_SF)
  {
        format (string, sizeof(string), "%s has left the Infernus!", playername);
        TextDrawSetString (text4, string);
        TextDrawShowForAll (text4);
        PlaySoundForAll(1150);
        SetTimer ("Destroy4", 3000, false);
        man[playerid] = 0;
        return 1;
        }
    return 1;
}



Re: fail... :O - KnooL - 22.01.2010

pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    new playervehicleid = GetPlayerVehicleID(playerid);
  new string[256]; new playername[MAX_PLAYER_NAME];
  GetPlayerName (playerid, playername, sizeof(playername));

  if((playervehicleid == PLANE_LS || PLANE_SF || PLANE_LS2 || PLANE_SF2) && (GetPlayerTeam(playerid) == TEAM_LS || TEAM_SF))
  {
        format (string, sizeof(string), "%s has left the Infernus!", playername);
        TextDrawSetString (text4, string);
        TextDrawShowForAll (text4);
        PlaySoundForAll(1150);
        SetTimer ("Destroy4", 3000, false);
        man[playerid] = 0;
        return 1;
        }
    return 1;
}
If I'm not mistaken you have to put it as one. So here it is


Re: fail... :O - Joe Staff - 22.01.2010

I'm not sure if you can make conditionals that way.

pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
  if( (newstate==PLAYER_STATE_ON_FOOT) && (oldstate==PLAYER_STATE_DRIVER) )
  {
    new pvehid=GetPlayerVehicleID(playerid);
    new string[256];
    GetPlayerName(playerid,string,sizeof(string));
    if( ( (pvehid==PLANE_LS) || (pvehid==PLANE_SF) || (pvehid==PLANE_LS2) || (pvehid==PLANE_SF2) ) && ( (GetPlayerTeam(playerid)==TEAM_LS) ||(GetPlayerTeam(playerid)==TEAM_SF) ) )
    {
      //Code
    }
  }
  return 1;
}
Notice that I'm using a different callback, this way it won't say that if the player ileaving the passenger seat.


Re: fail... :O - `FuTuRe- - 22.01.2010

in onplayerstatechange i already have like 200 lines . i need it on onplayerexitvehicle. I used KnooL's code but still doing the same.


Re: fail... :O - Joe Staff - 22.01.2010

It won't change anything if you add that code on otp of your other stuff inside of OnPlayerStateChange