SA-MP Forums Archive
Error on compiling(character's car) - 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: Error on compiling(character's car) (/showthread.php?tid=61207)



Error on compiling(character's car) - ricis5543 - 11.01.2009

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?


Re: Error on compiling(character's car) - Serbish - 11.01.2009

Код:
#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;
}



Re: Error on compiling(character's car) - c-middia - 17.04.2009

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