/windows help.
#1

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



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

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

DELETED
Reply
#5

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

- Indentation Tutorial.
Reply
#7

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

Quote:
Originally Posted by Karaula
for this warning use

Код:
#pragma tabsize 0
LOL?
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)