ID('s) problem
#1

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
Reply
#2

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....
Reply
#3

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;
}
Reply
#4

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
Reply
#5


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..
Reply
#6

@Rizard:

It shouldn't make everybody LVPD,

Put up your SetPlayerTeam that may be the problem.
Reply
#7

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
Reply
#8

Код:
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
Reply
#9

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
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)