SA-MP Forums Archive
/windows help. - 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: /windows help. (/showthread.php?tid=100517)



/windows help. - Tudor23 - 04.10.2009

pawn Код:
if(strcmp(cmd, "/wi", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(IsABike(GetPlayerVehicleID(playerid)))
            {
              SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Bikes don't have windows.");
              return 1;
            }
          if(CarWindowStatus[GetPlayerVehicleID(playerid)] == 1)
          {
            if(PlayerInfo[playerid][pSex] == 1)
                {
                    PlayerActionMessage(playerid,15.0,"has just rolled the windows down in his vehicle.");
                }
                else
                {
                    PlayerActionMessage(playerid,15.0,"has just rolled the windows down in her vehicle.");
                }
                CarWindowStatus[GetPlayerVehicleID(playerid)] = 0;
          }
          else if(CarWindowStatus[GetPlayerVehicleID(playerid)] == 0)
          {
            if(PlayerInfo[playerid][pSex] == 1)
                {
                    PlayerActionMessage(playerid,15.0,"has just rolled up the windows in his vehicle.");
                }
                else
                {
                    PlayerActionMessage(playerid,15.0,"has just rolled up the windows in her vehicle.");
                }
                CarWindowStatus[GetPlayerVehicleID(playerid)] = 1;
          }
        }
        else
        {
            SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[ERROR:] Your not in a vehicle!");
        }
        return 1;
    }
I got this command, can someone help me to disable the name tags for the players out of car when the window is rolled up and to enable them when the window is down?


Re: /windows help. - Eazy_Efolife - 04.10.2009



Код:
if(strcmp(cmd, "/wi", true) == 0)
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
			if(IsABike(GetPlayerVehicleID(playerid)))
			{
			  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Bikes don't have windows.");
			  return 1;
			}
		  if(CarWindowStatus[GetPlayerVehicleID(playerid)] == 1)
		  {
		  	if(PlayerInfo[playerid][pSex] == 1)
				{
					PlayerActionMessage(playerid,15.0,"has just rolled the windows down in his vehicle.");
                    ShowNameTags(true);
				}
				else
				{
					PlayerActionMessage(playerid,15.0,"has just rolled the windows down in her vehicle.");
                    ShowNameTags(true);
				}
				CarWindowStatus[GetPlayerVehicleID(playerid)] = 0;
		  }
		  else if(CarWindowStatus[GetPlayerVehicleID(playerid)] == 0)
		  {
		  	if(PlayerInfo[playerid][pSex] == 1)
				{
					PlayerActionMessage(playerid,15.0,"has just rolled up the windows in his vehicle.");
                    ShowNameTags(false);
				}
				else
				{
					PlayerActionMessage(playerid,15.0,"has just rolled up the windows in her vehicle.");
                    ShowNameTags(false);
				}
				CarWindowStatus[GetPlayerVehicleID(playerid)] = 1;
		  }
		}
		else
		{
			SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[ERROR:] Your not in a vehicle!");
		}
		return 1;
	}
And put:
Код:
ShowNameTags(true);
under OnPlayerExitVehicle


Re: /windows help. - Tudor23 - 04.10.2009

Quote:

C:\Documents and Settings\Administrator\Desktop\samp02Xserver.win32 \gamemodes\SWR.pwn(1333 : warning 217: loose indentation
C:\Documents and Settings\Administrator\Desktop\samp02Xserver.win32 \gamemodes\SWR.pwn(13343) : warning 217: loose indentation
C:\Documents and Settings\Administrator\Desktop\samp02Xserver.win32 \gamemodes\SWR.pwn(13352) : warning 217: loose indentation
C:\Documents and Settings\Administrator\Desktop\samp02Xserver.win32 \gamemodes\SWR.pwn(13357) : warning 217: loose indentation
C:\Documents and Settings\Administrator\Desktop\samp02Xserver.win32 \gamemodes\SWR.pwn(18767) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

Header size: 7800 bytes
Code size: 768364 bytes
Data size: 1773640 bytes
Stack/heap size: 16384 bytes; estimated max. usage=4320 cells (17280 bytes)
Total requirements: 2566188 bytes

5 Warnings.

Thanks for help anyway.


Re: /windows help. - Karaula - 05.10.2009

DELETED


Re: /windows help. - Correlli - 05.10.2009

Quote:
Originally Posted by Karaula
for this warning use

Код:
#pragma tabsize 0
Don't use this.

It's better if you indent your code by yourself.


Re: /windows help. - Zeromanster - 05.10.2009

- Indentation Tutorial.


Re: /windows help. - Tudor23 - 05.10.2009

Quote:
Originally Posted by Zeromanster
Thank you so much, that really helped me.


Re: /windows help. - eXchainZ-FoReVeR - 05.10.2009

Quote:
Originally Posted by Karaula
for this warning use

Код:
#pragma tabsize 0
LOL?


Re: /windows help. - Tudor23 - 05.10.2009

pawn Код:
if(strcmp(cmd, "/wi", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(IsABike(GetPlayerVehicleID(playerid)))
            {
              SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Bikes don't have windows.");
              return 1;
            }
          if(CarWindowStatus[GetPlayerVehicleID(playerid)] == 1)
          {
            if(PlayerInfo[playerid][pSex] == 1)
                {
                PlayerActionMessage(playerid,15.0,"has just rolled the windows down in his vehicle.");
                ShowNameTags(true);
            }
        else
            {
                PlayerActionMessage(playerid,15.0,"has just rolled the windows down in her vehicle.");
                ShowNameTags(true);
            }
            CarWindowStatus[GetPlayerVehicleID(playerid)] = 0;
        }
        else if(CarWindowStatus[GetPlayerVehicleID(playerid)] == 0)
            {
            if(PlayerInfo[playerid][pSex] == 1)
                {
                PlayerActionMessage(playerid,15.0,"has just rolled up the windows in his vehicle.");
                ShowNameTags(false);
            }
            else
                {
                PlayerActionMessage(playerid,15.0,"has just rolled up the windows in her vehicle.");
            ShowNameTags(false);
            }
            CarWindowStatus[GetPlayerVehicleID(playerid)] = 1;
        }
    }
    else
        {
        SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[ERROR:] Your not in a vehicle!");
    }
        return 1;
}
I tried to indentite(or how's spelled) it, but I failed, can someone help me and tell me where I mistook?


Re: /windows help. - Silent314 - 06.10.2009

pawn Код:
if(strcmp(cmd, "/wi", true) == 0)
{
  if(IsPlayerInAnyVehicle(playerid))
  {
    if(IsABike(GetPlayerVehicleID(playerid)))
    {
       SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Bikes don't have windows.");
      return 1;
    }
    if(CarWindowStatus[GetPlayerVehicleID(playerid)] == 1)
    {
      if(PlayerInfo[playerid][pSex] == 1)
      {
        PlayerActionMessage(playerid,15.0,"has just rolled the windows down in his vehicle.");
          ShowNameTags(true);
      }
      else
      {
        PlayerActionMessage(playerid,15.0,"has just rolled the windows down in her vehicle.");
        ShowNameTags(true);
      }
      CarWindowStatus[GetPlayerVehicleID(playerid)] = 0;
    }
    else if(CarWindowStatus[GetPlayerVehicleID(playerid)] == 0)
    {
      if(PlayerInfo[playerid][pSex] == 1)
      {
        PlayerActionMessage(playerid,15.0,"has just rolled up the windows in his vehicle.");
        ShowNameTags(false);
      }
      else
      {
        PlayerActionMessage(playerid,15.0,"has just rolled up the windows in her vehicle.");
        ShowNameTags(false);
      }
      CarWindowStatus[GetPlayerVehicleID(playerid)] = 1;
    }
  }
  else
  {
    SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"[ERROR:] Your not in a vehicle!");
  }
    return 1;
}