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



ID('s) problem - Rizard - 23.05.2009

My code:
Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
  new Menu:CurrentMenu = GetPlayerMenu(playerid);
  if(CurrentMenu == lvpdmenu)
  {
	  switch(row)
	  {
	    case 0: //request
	    {
	       for(new i; i < MAX_PLAYERS; i++)
	       {
	       	 gTeam[i] = TEAM_LVPD;
		     SendClientMessage(i, 0x00FF00FF, "You are now LVPD, Welcome!");
		     SetPlayerTeam(i, TEAM_LVPD);
 		   }
	    }
		case 1: //resign
		{
	       for(new i; i < MAX_PLAYERS; i++)
	       {
		      gTeam[i] = TEAM_CIVIL;
		      SendClientMessage(i, 0x00FF00FF, "You are no longer LVPD");
			  SetPlayerTeam(i, TEAM_CIVIL);
		   }
		 }

	   }
  }
  return 1;
}
Porb?!:
Well, when I click the request option in the menu every player in the game get's the message "You are now LVPD, Welcome!" and everybody becomes LVPD as well !?

Something 2 do with those playerid's again but can I fix it with ease?

Greetzz Rizzy


Re: Can't get single Team activation - ID('s) problem - Weirdosport - 23.05.2009

pawn Код:
for(new i; i < MAX_PLAYERS; i++)
           {
             gTeam[i] = TEAM_LVPD;
             SendClientMessage(i, 0x00FF00FF, "You are now LVPD, Welcome!");
             SetPlayerTeam(i, TEAM_LVPD);
           }
Why? that's why it's happening to everyone....


Re: Can't get single Team activation - ID('s) problem - miokie - 23.05.2009

pawn Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
  new Menu:CurrentMenu = GetPlayerMenu(playerid);
  if(CurrentMenu == lvpdmenu)
  {
      switch(row)
      {
        case 0: //request
        {
           gTeam[playerid] = TEAM_LVPD;
          SendClientMessage(playerid, 0x00FF00FF, "You are now LVPD, Welcome!");
          SetPlayerTeam(playerid, TEAM_LVPD);
        }
        case 1: //resign
        {
           gTeam[playerid] = TEAM_CIVIL;
           SendClientMessage(playerid, 0x00FF00FF, "You are no longer LVPD");
           SetPlayerTeam(playerid, TEAM_CIVIL);
         }

       }
  }
  return 1;
}



Re: Can't get single Team activation - ID('s) problem - Rizard - 23.05.2009

pawn Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
  new Menu:CurrentMenu = GetPlayerMenu(playerid);
  if(CurrentMenu == lvpdmenu)
  {
        switch(row)
        {
            case 0: //request
            {
                gTeam[playerid] = TEAM_LVPD;
                SendClientMessage(playerid, 0x00FF00FF, "You are now LVPD, Welcome!");
                SetPlayerTeam(playerid, TEAM_LVPD);
            }
            case 1: //resign
            {
                gTeam[playerid] = TEAM_CIVIL;
                SendClientMessage(playerid, 0x00FF00FF, "You are no longer LVPD");
                SetPlayerTeam(playerid, TEAM_CIVIL);
            }

        }
  }
  return 1;
}
With this code(*by Miokie), the messages are beeing printed right, so not everyone sees the text but everyone becomes LVPD still .... or resigns when one player does...??

Thnx for your reply's already

Greetz Rizzy


Re: Can't get single Team activation - ID('s) problem - Cabby - 23.05.2009


pawn Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
new Menu:CurrentMenu = GetPlayerMenu(playerid);
if(CurrentMenu == lvpdmenu)
{
switch(row)
{
case 0: //request
{
gTeam[playerid] = TEAM_LVPD;
SendClientMessage(playerid, 0x00FF00FF, "You are now LVPD, Welcome!");
}
case 1: //resign
{
gTeam[playerid] = TEAM_CIVIL;
SendClientMessage(playerid, 0x00FF00FF, "You are no longer LVPD");
}
}
}
return 1;
}
I think this might help..


Re: Can't get single Team activation - ID('s) problem - miokie - 23.05.2009

@Rizard:

It shouldn't make everybody LVPD,

Put up your SetPlayerTeam that may be the problem.


Re: Can't get single Team activation - ID('s) problem - Rizard - 23.05.2009

I have tryed tried the code from Zobero Zybero here but still... it makes everyone lvpd and another thing... there was a 3/4 player today and suddenly everything stopped working (gates I mean)
thenthey never opened again...

Greetzz Rizzy

PS: Thnx for keep helping me out here


Re: Can't get single Team activation - ID('s) problem - Rizard - 24.05.2009

Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
  new Menu:CurrentMenu = GetPlayerMenu(playerid);

	if(CurrentMenu == LVPD)
	{
	   switch(row)
	   {
       case 0:
	   {
		  for(new i=0; i < MAX_PLAYERS; i++)
		  {
	        gTeam[i] = TEAM_LVPD;
		      SendClientMessage(playerid,COLOR_BLUE,"You have been set as a police officer");
		      SetPlayerSkin(playerid,280);
		      TogglePlayerControllable(playerid,true);
		      return 1;
  			}
		 }
		 case 1:
         {
				if(gTeam[playerid] == TEAM_CIVIL)
				{
				SendClientMessage(playerid,COLOR_RED2,"You are not a police officer!");
				ShowMenuForPlayer(LVPD,playerid);
				return 1;
				}
				else
				{
					for(new i=0; i < MAX_PLAYERS; i++)
					{
						gTeam[i] = TEAM_CIVIL;
		                SendClientMessage(playerid,COLOR_BLUE,"You have resigned as police officer");
						SetPlayerSkin(playerid,VorigeSkin);
		                TogglePlayerControllable(playerid,true);
						return 1;
					}
				}
           }
     }
  }
  return 1;
}
Have this code atm... djeez i'm getting dizzy of all those different things i'm trying ...
The Problem remains the same : When one player request, everyone turns into lvpd, and idem with resign. I tried withouth the for loop and with [playerid] but nothing seems to do the job? :O any peeps had experience with this?

Greets Rizzy

EDIT: Is this double post? srry for that


Re: Can't get single Team activation - ID('s) problem - Rizard - 03.06.2009

Don't need new topic for this right?

Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
  if(GetPlayerMenu(playerid) == LVPDMenu)
  {
      switch(row)
      {
	    case 0:
			{
			  if(gTeam[playerid] == TEAM_LVPD)
			  {
			  SendClientMessage(playerid,COLOR_RED2,"You are already member of this Organization!");
			  TogglePlayerControllable(playerid,true);
			  return 1;
			  }
			  SendClientMessage(playerid,COLOR_BLUE,"You have joined Las Venturas Police Dept");
			  SendClientMessage(playerid,0xF0DC82FF,"Your job is to help making Las Venturas a better place!");
			  SendClientMessage(playerid,0xF0DC82FF,"Type /lvcmds to see a list of commands.");
			  gTeam[playerid] = TEAM_LVPD;
			  GivePlayerWeapon(playerid, 24,20);
			  SetPlayerTeam(playerid,TEAM_LVPD);
			  OnPlayerShiftTeam(playerid);
			  TogglePlayerControllable(playerid,true);
			  return 1;
			}
			case 1:
			{
			  if(gTeam[playerid] == TEAM_CIVILIAN)
			  {
			  SendClientMessage(playerid,COLOR_RED2,"You are not member of this Organization!");
			  TogglePlayerControllable(playerid,true);
			  return 1;
			  }
			  SendClientMessage(playerid,COLOR_BLUE,"You have resigned from Las Venturas Police Dept");
			  gTeam[playerid] = TEAM_CIVILIAN;
			  SetPlayerTeam(playerid,TEAM_CIVILIAN);
			  OnPlayerShiftTeam(playerid);
			  SetPlayerSkin(playerid, VorigeSkin);
			  TogglePlayerControllable(playerid,true);
			  return 1;
	    }
      }
  }
  return 1;
}
I tried this with 2 players online, first id 1 went to the gate (was no cop yet, so the gates wouldn't open) and id 0 went to the checkpoint and joined the lvpd force.... there's problem nr 1, the other player with id 1 also became lvpd and the gates opened :O. Now when i resigned we both became civil again. The other way around worked perfectly! when id 0 is at the gate, and id 1 joins LVPD , id 0 still stays civil !


Pls tell me someone can fix this ID problem! PLS, I'm working on this problem for a long time together with Zybero who send me this code to test

Thnx for that zybero!

Grts Rizzy


Re: ID('s) problem - Rizard - 14.06.2009

Having this code now, I thought it would work but it still doesn't, TY Zybero for your help untill now!

But there isn't anyone else who want's to help figure this thing out ... if I'm making a pretty STUPID mistake, just say so pls !

I posted my code on pastebin this time.

Hope u guys check it out TY

Greetz Rizzy