Error on compiling(character's car)
#1

Hi everyone!
I have a little problem, with one filterscript. Which can't Compile succesfully.
It shows one error. I don't understand that. Maybe you could help me.

Here is the code:

Код:
#include <a_samp>
new Hery_Deizo;
new Tomas_Slavinskas;
public OnGameModeInit()
{
Hery_Deizo = AddStaticVehicle(422,-256.2316,1159.1613,19.4457,90.4772,1,1);
Tomas_Slavinskas = AddStaticVehicle(580,-306.0162,1115.7000,19.6242,179.6534,1,1);
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  if (vehicleid == Hery_Deizo)
  {
    new PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    if(strcmp(PlayerName, "Hery_Deizo", true) == 0)
    {
      SendClientMessage(playerid, 0xAA3333AA,"This car is yours");
    }
    else
    {
      SendClientMessage(playerid, 0xAA3333AA, "This car's owner is Hery_Deizo !");
      PutPlayerInVehicle(playerid, vehicleid, 1);
    }
  if (vehicleid == Tomas_Slavinskas)
  {
    new PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    if(strcmp(PlayerName, "Tomas_Slavinskas", true) == 0)
    {
      SendClientMessage(playerid, 0xAA3333AA,"This car is yours");
    }
    else
    {
      SendClientMessage(playerid, 0xAA3333AA, "This car's owner is Tomas_Slavinskas !");
      PutPlayerInVehicle(playerid, vehicleid, 1);
    }
  }
  return 1;
}
And I've got the error when compiling:

Код:
D:\FCRP\filterscripts\tcar.pwn(25) : warning 217: loose indentation
D:\FCRP\filterscripts\tcar.pwn(27) : warning 219: local variable "PlayerName" shadows a variable at a preceding level
D:\FCRP\filterscripts\tcar.pwn(42) : error 030: compound statement not closed at the end of file (started at line 12)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Where is the problem?
Reply
#2

Код:
#include <a_samp>

new Hery_Deizo;
new Tomas_Slavinskas;

public OnGameModeInit()
{
	Hery_Deizo = AddStaticVehicle(422,-256.2316,1159.1613,19.4457,90.4772,1,1);
	Tomas_Slavinskas = AddStaticVehicle(580,-306.0162,1115.7000,19.6242,179.6534,1,1);
	return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  if (vehicleid == Hery_Deizo)
  {
		new PlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
		if(strcmp(PlayerName, "Hery_Deizo", true) == 0)
		{
			SendClientMessage(playerid, 0xAA3333AA,"This car is yours");
		}
		else
		{
			SendClientMessage(playerid, 0xAA3333AA, "This car's owner is Hery_Deizo !");
			PutPlayerInVehicle(playerid, vehicleid, 1);
    }
	}
	if (vehicleid == Tomas_Slavinskas)
	{
		new PlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
		if(strcmp(PlayerName, "Tomas_Slavinskas", true) == 0)
    {
      SendClientMessage(playerid, 0xAA3333AA,"This car is yours");
    }
    else
    {
      SendClientMessage(playerid, 0xAA3333AA, "This car's owner is Tomas_Slavinskas !");
      PutPlayerInVehicle(playerid, vehicleid, 1);
    }
  }
  return 1;
}
Reply
#3

Код:
#include <a_samp>
new PlayerName[MAX_PLAYER_NAME]; // <<<< add this here remove the lower ones
new Hery_Deizo;
new Tomas_Slavinskas;
public OnGameModeInit()
{
Hery_Deizo = AddStaticVehicle(422,-256.2316,1159.1613,19.4457,90.4772,1,1);
Tomas_Slavinskas = AddStaticVehicle(580,-306.0162,1115.7000,19.6242,179.6534,1,1);
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  if (vehicleid == Hery_Deizo)
  {
    //new PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    if(strcmp(PlayerName, "Hery_Deizo", true) == 0)
    {
      SendClientMessage(playerid, 0xAA3333AA,"This car is yours");
    }
    else
    {
      SendClientMessage(playerid, 0xAA3333AA, "This car's owner is Hery_Deizo !");
      PutPlayerInVehicle(playerid, vehicleid, 1);
    }
  if (vehicleid == Tomas_Slavinskas)
  {
    //new PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    if(strcmp(PlayerName, "Tomas_Slavinskas", true) == 0)
    {
      SendClientMessage(playerid, 0xAA3333AA,"This car is yours");
    }
    else
    {
      SendClientMessage(playerid, 0xAA3333AA, "This car's owner is Tomas_Slavinskas !");
      PutPlayerInVehicle(playerid, vehicleid, 1);
    }
  }
  return 1;
}
this should fix your error
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)