SA-MP Forums Archive
Skip class selection after death - 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: Skip class selection after death (/showthread.php?tid=546030)



Skip class selection after death - ohmy - 12.11.2014

how i skip class selection after i dead, and assign to previous team before im die

can you tell me the code/script for that


Re: Skip class selection after death - RedFusion - 12.11.2014

You only have to choose your class once, and then you respawn with it.


Re: Skip class selection after death - ohmy - 12.11.2014

nope, in my script when im death, it return to class selection (im swear im not press F4)

any supporting script?


Re: Skip class selection after death - RedFusion - 12.11.2014

Read this
Quote:
Returning 0 in this callback will prevent the player from spawning. The player can be forced to spawn when SpawnPlayer is used, however the player will re-enter class selection the next time they die.



Re: Skip class selection after death - ohmy - 12.11.2014

So, I have to put
pawn Код:
return 0;
On OnPlayerDeath?

EDIT: im already use return 0; in the OnPlayerRequestClass
i add return 0; in the script and got Unreachable Code
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    {
      SetPlayerPos(playerid, 1424.1958,-973.2076,57.5156);
      SetPlayerCameraPos(playerid, 1423.8972,-976.9398,57.5156);
      SetPlayerFacingAngle(playerid, 176.5765);
      SetPlayerCameraLookAt(playerid, 1424.1958,-973.2076,57.5156);

      ForceClassSelection(playerid);
      TogglePlayerSpectating(playerid, true);
      TogglePlayerSpectating(playerid, false);
      TogglePlayerControllable(playerid,0);
      if(GetPlayerSkin(playerid) == 105) GameTextForPlayer(playerid,"~g~Grove Street Families",2000,5);
      if(GetPlayerSkin(playerid) == 280) GameTextForPlayer(playerid,"~b~Police Officer",2000,5);
      if(GetPlayerSkin(playerid) == 29) GameTextForPlayer(playerid,"~w~Civilian",2000,5);
      if(GetPlayerSkin(playerid) == 61) GameTextForPlayer(playerid,"~y~Pilot",2000,5);
      SetPlayerTeamFromClass(playerid, classid);
      new gPlayerCitySelection[MAX_PLAYERS];
      new gPlayerHasCitySelected[MAX_PLAYERS];
      new gPlayerLastCitySelectionTick[MAX_PLAYERS];
      gPlayerHasCitySelected[playerid] = 0;
      gPlayerCitySelection[playerid] = 0;
      gPlayerLastCitySelectionTick[playerid] = 0;
      return 0;
    }
    return 1;
}
In return 1; line


Re: Skip class selection after death - RedFusion - 12.11.2014

You misunderstood me. If you want to spawn and skip class selection, return 1. Don't return 0.


Re: Skip class selection after death - ohmy - 13.11.2014

Quote:
Originally Posted by RedFusion
Посмотреть сообщение
You misunderstood me. If you want to spawn and skip class selection, return 1. Don't return 0.
Can you just give me the PAWN code?


Re: Skip class selection after death - RedFusion - 13.11.2014

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
      SetPlayerPos(playerid, 1424.1958,-973.2076,57.5156);
      SetPlayerCameraPos(playerid, 1423.8972,-976.9398,57.5156);
      SetPlayerFacingAngle(playerid, 176.5765);
      SetPlayerCameraLookAt(playerid, 1424.1958,-973.2076,57.5156);

      ForceClassSelection(playerid);
      TogglePlayerSpectating(playerid, true);
      TogglePlayerSpectating(playerid, false);
      TogglePlayerControllable(playerid,0);
      if(GetPlayerSkin(playerid) == 105) GameTextForPlayer(playerid,"~g~Grove Street Families",2000,5);
      if(GetPlayerSkin(playerid) == 280) GameTextForPlayer(playerid,"~b~Police Officer",2000,5);
      if(GetPlayerSkin(playerid) == 29) GameTextForPlayer(playerid,"~w~Civilian",2000,5);
      if(GetPlayerSkin(playerid) == 61) GameTextForPlayer(playerid,"~y~Pilot",2000,5);
      SetPlayerTeamFromClass(playerid, classid);
      new gPlayerCitySelection[MAX_PLAYERS];
      new gPlayerHasCitySelected[MAX_PLAYERS];
      new gPlayerLastCitySelectionTick[MAX_PLAYERS];
      gPlayerHasCitySelected[playerid] = 0;
      gPlayerCitySelection[playerid] = 0;
      gPlayerLastCitySelectionTick[playerid] = 0;
    return 1;
}



Re: Skip class selection after death - ohmy - 13.11.2014

Still Taking Me To Class Selection


Re: Skip class selection after death - Quickie - 13.11.2014

show your onplayerdeath callback