SA-MP Forums Archive
What's wrong? - 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: What's wrong? (/showthread.php?tid=96560)



What's wrong? - xCoder - 09.09.2009

Код:
public OnPlayerDisconnect(playerid, reason)
{
	if(takim[playerid] == 1)
	{
	if(currClass[playerid] == 0)
	{
 	teamPlayers[0]--;
  }
  	else if(currClass[playerid] == 1)
  {
    teamPlayers[0]--;
  }
  else if(currClass[playerid] == 2)
  {
    teamPlayers[0]--;
  }
  else if(currClass[playerid] == 3)
  {
    teamPlayers[1]--;
  }
  else if(currClass[playerid] == 4)
  {
    teamPlayers[1]--;
  }
  else if(currClass[playerid] == 5)
  {
  teamPlayers[1]--;
  }
  }
  else if(takim[playerid] == 1)
  {
  //Do nothing
  }
  return 0;
}
I wanna if takim = 1 and currClass = 0,1,2 teamPlayers[0]-- and if takim = 1 and currClass,3,4,5 teamPlayers[0]--

But it doesn't work. Please help me

(OnPlayerSpawn has takim[playerid] ==1)


Re: What's wrong? - abhinavdabral - 09.09.2009

See this
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
  if(takim[playerid]==1){
    if(currClass[playerid]==0 || currClass[playerid]==1 || currClass[playerid]==2) teamPlayers[0]--;
    if(currClass[playerid]==3 || currClass[playerid]==4 || currClass[playerid]==5) teamPlayers[1]--;
  }
  return 1;
}
I hope it will help you.
-Abhinav


Re: What's wrong? - xCoder - 09.09.2009

didn't help


Re: What's wrong? - Donny_k - 09.09.2009

Use a 'switch':

pawn Код:
switch( some_variable )
{
  case 0 : //do this
  case 1 : //do this
}