Little Error With code ,
#1

I have error with code , mabye somebody can fix it ?

Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
  TogglePlayerControllable(playerid, 1);
	if (GetPlayerState(playerid) == 1)
	{
		return 1;
	}
  if(PlayerInfo[playerid][pSeatBelt] == 1)
  {
   	PlayerInfo[playerid][pSeatBelt] = 0;
    new stringtosee[255];
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new ftext[255];
    if(PlayerInfo[playerid][pSex] == 1)
		{
		  ftext = "his";
		}
    else if(PlayerInfo[playerid][pSex] == 1)
		{
		  ftext = "her";
		}
    format(stringtosee, sizeof(stringtosee), "* %s unbuckles %s seat belt", sendername , ftext);
    ProxDetector(30.0, playerid, stringtosee, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
   	return 1;
	 }
	/*if(gGas[playerid] == 1)
	{
	  GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~Left car", 500, 3);
	}*/
	return 1;
}

	if(IsAHarvest(vehicleid))
	{
	  if(FarmerVar[playerid] == 1)
	  {
			SetTimer("FarmerExit", 7000, 0);
			GameTextForPlayer(playerid, "~n~~w~You have ~r~7~w~ seconds~n~to get back on a harvest", 5000, 3);
	  }
	}
	if(IsADrugHarvest(vehicleid))
	{
	  if(DrugFarmerVar[playerid] == 1)
	  {
			SetTimer("DrugFarmerExit", 7000, 0);
			GameTextForPlayer(playerid, "~n~~w~You have ~b~7~w~ seconds~n~to get back on a harvest", 5000, 3);
	  }
	}
	if(IsASmuggleCar(vehicleid))
	{
	  if(SmugglerWork[playerid] == 1)
	  {
	    SetTimer("SmugglerExit", 7000, 0);
	    GameTextForPlayer(playerid, "~n~~w~You have ~r~7~w~ seconds~n~to get back in car", 5000, 3);
		}
	}
	if(gGas[playerid] == 1)
	{
	  GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~Left car", 500, 3);}
	}
	if (BusrouteEast[playerid][0] != 0 || BusrouteWest[playerid][0] != 0)
	{
		BusrouteEnd(playerid, vehicleid);
	}
	if (IsABus(vehicleid))
	{
		for (new i=0; i<=MAX_PLAYERS; i++)
		{
			if (IsPlayerConnected(i))
			{
				if (BusrouteEast[i][0] != 0 && BusrouteEast[i][1] == vehicleid)
				{
					//BusrouteEast[i][2] --;
					GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~g~Passenger Left The Bus", 5000, 3);
				}
				else if (BusrouteWest[i][0] != 0 && BusrouteWest[i][1] == vehicleid)
				{
					//BusrouteWest[i][2] --;
					GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~g~Passenger Left The Bus", 5000, 3);
				}
			}
		}
	}
	return 1;
}
Errors:

(8089) : error 010: invalid function or declaration
(8091) : error 010: invalid function or declaration
(8097) : error 010: invalid function or declaration
(8099) : error 010: invalid function or declaration
(8105) : error 010: invalid function or declaration
(8107) : error 010: invalid function or declaration
(8113) : error 010: invalid function or declaration
(8117) : error 010: invalid function or declaration
(8119) : warning 218: old style prototypes used with optional semicolumns
(8120) : error 054: unmatched closing brace ("}")
(8121) : error 010: invalid function or declaration
(8123) : error 010: invalid function or declaration
(8125) : error 010: invalid function or declaration
(8127) : error 010: invalid function or declaration
(8130) : error 021: symbol already defined: "GameTextForPlayer"
(8132) : error 010: invalid function or declaration
(8135) : error 021: symbol already defined: "GameTextForPlayer"
(8140) : error 010: invalid function or declaration

i hope somebody can help me.
Reply
#2

You had a return 1; in the middle, so i put all the code inside that OnPlayerExitVehicle callback if that is how it is meant to be.

pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
  TogglePlayerControllable(playerid, 1);
    if (GetPlayerState(playerid) == 1)
    {
        return 1;
    }
  if(PlayerInfo[playerid][pSeatBelt] == 1)
  {
    PlayerInfo[playerid][pSeatBelt] = 0;
    new stringtosee[255];
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new ftext[255];
    if(PlayerInfo[playerid][pSex] == 1)
        {
          ftext = "his";
        }
    else if(PlayerInfo[playerid][pSex] == 1)
        {
          ftext = "her";
        }
    format(stringtosee, sizeof(stringtosee), "* %s unbuckles %s seat belt", sendername , ftext);
    ProxDetector(30.0, playerid, stringtosee, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
    return 1;
     }
    /*if(gGas[playerid] == 1)
    {
      GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~Left car", 500, 3);
    }*/

    if(IsAHarvest(vehicleid))
    {
      if(FarmerVar[playerid] == 1)
      {
            SetTimer("FarmerExit", 7000, 0);
            GameTextForPlayer(playerid, "~n~~w~You have ~r~7~w~ seconds~n~to get back on a harvest", 5000, 3);
      }
    }
    if(IsADrugHarvest(vehicleid))
    {
      if(DrugFarmerVar[playerid] == 1)
      {
            SetTimer("DrugFarmerExit", 7000, 0);
            GameTextForPlayer(playerid, "~n~~w~You have ~b~7~w~ seconds~n~to get back on a harvest", 5000, 3);
      }
    }
    if(IsASmuggleCar(vehicleid))
    {
      if(SmugglerWork[playerid] == 1)
      {
        SetTimer("SmugglerExit", 7000, 0);
        GameTextForPlayer(playerid, "~n~~w~You have ~r~7~w~ seconds~n~to get back in car", 5000, 3);
        }
    }
    if(gGas[playerid] == 1)
    {
      GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~Left car", 500, 3);}
    }
    if (BusrouteEast[playerid][0] != 0 || BusrouteWest[playerid][0] != 0)
    {
        BusrouteEnd(playerid, vehicleid);
    }
    if (IsABus(vehicleid))
    {
        for (new i=0; i<=MAX_PLAYERS; i++)
        {
            if (IsPlayerConnected(i))
            {
                if (BusrouteEast[i][0] != 0 && BusrouteEast[i][1] == vehicleid)
                {
                    //BusrouteEast[i][2] --;
                    GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~g~Passenger Left The Bus", 5000, 3);
                }
                else if (BusrouteWest[i][0] != 0 && BusrouteWest[i][1] == vehicleid)
                {
                    //BusrouteWest[i][2] --;
                    GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~g~Passenger Left The Bus", 5000, 3);
                }
            }
        }
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by [B2K
Hustler ]
You had a return 1; in the middle, so i put all the code inside that OnPlayerExitVehicle callback if that is how it is meant to be.

pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
  TogglePlayerControllable(playerid, 1);
    if (GetPlayerState(playerid) == 1)
    {
        return 1;
    }
  if(PlayerInfo[playerid][pSeatBelt] == 1)
  {
    PlayerInfo[playerid][pSeatBelt] = 0;
    new stringtosee[255];
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new ftext[255];
    if(PlayerInfo[playerid][pSex] == 1)
        {
          ftext = "his";
        }
    else if(PlayerInfo[playerid][pSex] == 1)
        {
          ftext = "her";
        }
    format(stringtosee, sizeof(stringtosee), "* %s unbuckles %s seat belt", sendername , ftext);
    ProxDetector(30.0, playerid, stringtosee, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
    return 1;
     }
    /*if(gGas[playerid] == 1)
    {
      GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~Left car", 500, 3);
    }*/

    if(IsAHarvest(vehicleid))
    {
      if(FarmerVar[playerid] == 1)
      {
            SetTimer("FarmerExit", 7000, 0);
            GameTextForPlayer(playerid, "~n~~w~You have ~r~7~w~ seconds~n~to get back on a harvest", 5000, 3);
      }
    }
    if(IsADrugHarvest(vehicleid))
    {
      if(DrugFarmerVar[playerid] == 1)
      {
            SetTimer("DrugFarmerExit", 7000, 0);
            GameTextForPlayer(playerid, "~n~~w~You have ~b~7~w~ seconds~n~to get back on a harvest", 5000, 3);
      }
    }
    if(IsASmuggleCar(vehicleid))
    {
      if(SmugglerWork[playerid] == 1)
      {
        SetTimer("SmugglerExit", 7000, 0);
        GameTextForPlayer(playerid, "~n~~w~You have ~r~7~w~ seconds~n~to get back in car", 5000, 3);
        }
    }
    if(gGas[playerid] == 1)
    {
      GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~Left car", 500, 3);}
    }
    if (BusrouteEast[playerid][0] != 0 || BusrouteWest[playerid][0] != 0)
    {
        BusrouteEnd(playerid, vehicleid);
    }
    if (IsABus(vehicleid))
    {
        for (new i=0; i<=MAX_PLAYERS; i++)
        {
            if (IsPlayerConnected(i))
            {
                if (BusrouteEast[i][0] != 0 && BusrouteEast[i][1] == vehicleid)
                {
                    //BusrouteEast[i][2] --;
                    GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~g~Passenger Left The Bus", 5000, 3);
                }
                else if (BusrouteWest[i][0] != 0 && BusrouteWest[i][1] == vehicleid)
                {
                    //BusrouteWest[i][2] --;
                    GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~g~Passenger Left The Bus", 5000, 3);
                }
            }
        }
    }
    return 1;
}
i tryed with that way too before but with that are these errors:

(8045) : warning 209: function "OnPlayerExitVehicle" should return a value
(8046) : error 010: invalid function or declaration
(804 : warning 218: old style prototypes used with optional semicolumns
(8049) : error 054: unmatched closing brace ("}")
(8050) : error 010: invalid function or declaration
(8052) : error 010: invalid function or declaration
(8054) : error 010: invalid function or declaration
(8056) : error 010: invalid function or declaration
(8059) : error 021: symbol already defined: "GameTextForPlayer"
(8061) : error 010: invalid function or declaration
(8064) : error 021: symbol already defined: "GameTextForPlayer"
(8069) : error 010: invalid function or declaration
Reply
#4

Bump
Reply
#5

How's this?

pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
  TogglePlayerControllable(playerid, 1);
    if(GetPlayerState(playerid) == 1)
        return 1;
       
  if(PlayerInfo[playerid][pSeatBelt] == 1)
  {
    PlayerInfo[playerid][pSeatBelt] = 0;
    new stringtosee[255];
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new ftext[255];
    if(PlayerInfo[playerid][pSex] == 1)
          ftext = "his";

    else if(PlayerInfo[playerid][pSex] == 0)
          ftext = "her";

    format(stringtosee, sizeof(stringtosee), "* %s unbuckles %s seat belt", sendername , ftext);
    ProxDetector(30.0, playerid, stringtosee, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
    return 1;
     }
    /*if(gGas[playerid] == 1)
    {
      GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~Left car", 500, 3);
    }*/

    if(IsAHarvest(vehicleid))
    {
      if(FarmerVar[playerid] == 1)
      {
            SetTimer("FarmerExit", 7000, 0);
            GameTextForPlayer(playerid, "~n~~w~You have ~r~7~w~ seconds~n~to get back on a harvest", 5000, 3);
      }
    }
    if(IsADrugHarvest(vehicleid))
    {
      if(DrugFarmerVar[playerid] == 1)
      {
            SetTimer("DrugFarmerExit", 7000, 0);
            GameTextForPlayer(playerid, "~n~~w~You have ~b~7~w~ seconds~n~to get back on a harvest", 5000, 3);
      }
    }
    if(IsASmuggleCar(vehicleid))
    {
      if(SmugglerWork[playerid] == 1)
      {
        SetTimer("SmugglerExit", 7000, 0);
        GameTextForPlayer(playerid, "~n~~w~You have ~r~7~w~ seconds~n~to get back in car", 5000, 3);
        }
    }
    if(gGas[playerid] == 1)
    {
      GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~Left car", 500, 3);}
    }
    if (BusrouteEast[playerid][0] != 0 || BusrouteWest[playerid][0] != 0)
    {
        BusrouteEnd(playerid, vehicleid);
    }
    if (IsABus(vehicleid))
    {
        for (new i=0; i<=MAX_PLAYERS; i++)
        {
            if (IsPlayerConnected(i))
            {
                if (BusrouteEast[i][0] != 0 && BusrouteEast[i][1] == vehicleid)
                    //BusrouteEast[i][2] --;
                    GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~g~Passenger Left The Bus", 5000, 3);
                else if (BusrouteWest[i][0] != 0 && BusrouteWest[i][1] == vehicleid)
                    //BusrouteWest[i][2] --;
                    GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~g~Passenger Left The Bus", 5000, 3);
            }
        }
    }
    return 1;
}
Would be nice if you posted which lines actually give you the error.
Reply
#6

Quote:
Originally Posted by Ettans
How's this?

pawn Код:
7987|public OnPlayerExitVehicle(playerid, vehicleid)
7988|{
7989|TogglePlayerControllable(playerid, 1);
7990|   if(GetPlayerState(playerid) == 1)
7991|
7992|       return 1;      
7993|if(PlayerInfo[playerid][pSeatBelt] == 1)
7994|{
7995|PlayerInfo[playerid][pSeatBelt] = 0;
7996|new stringtosee[255];
7997|new sendername[MAX_PLAYER_NAME];
7998|GetPlayerName(playerid, sendername, sizeof(sendername));
7999|new ftext[255];
8000|if(PlayerInfo[playerid][pSex] == 1)
8001|         ftext = "his";
8002|
8003|else if(PlayerInfo[playerid][pSex] == 0)
8004|         ftext = "her";
8005|
8006|format(stringtosee, sizeof(stringtosee), "* %s unbuckles %s seat belt", sendername , ftext);
8007| ProxDetector(30.0, playerid, stringtosee, 0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA,0xC2A2DAAA);
8008|return 1;
8009|    }
8010|   /*if(gGas[playerid] == 1)
8011|   {
8012|     GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~Left car", 500, 3);
8013|   }*/

8014|   if(IsAHarvest(vehicleid))
8015|   {
8016|     if(FarmerVar[playerid] == 1)
8017|     {
8018|           SetTimer("FarmerExit", 7000, 0);
8019|           GameTextForPlayer(playerid, "~n~~w~You have ~r~7~w~ seconds~n~to get back on a harvest", 5000, 3);
8020|     }
8021|   }
8022|   if(IsADrugHarvest(vehicleid))
8023|   {
8024|     if(DrugFarmerVar[playerid] == 1)
8025|     {
8026|           SetTimer("DrugFarmerExit", 7000, 0);
8027|           GameTextForPlayer(playerid, "~n~~w~You have ~b~7~w~ seconds~n~to get back on a harvest", 5000, 3);
8028|     }
8029|   }
8030|   if(IsASmuggleCar(vehicleid))
8031|   {
8032|     if(SmugglerWork[playerid] == 1)
8033|     {
8034|       SetTimer("SmugglerExit", 7000, 0);
8035|       GameTextForPlayer(playerid, "~n~~w~You have ~r~7~w~ seconds~n~to get back in car", 5000, 3);
8036|       }
8037|   }
8038|   if(gGas[playerid] == 1)
8039|   {
8040|     GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~Left car", 500, 3);}
8041|   }
8042|   if (BusrouteEast[playerid][0] != 0 || BusrouteWest[playerid][0] != 0)
8043|   {
8044|       BusrouteEnd(playerid, vehicleid);
8045|   }
8046|   if (IsABus(vehicleid))
8047|   {
8048|       for (new i=0; i<=MAX_PLAYERS; i++)
8049|       {
8050|           if (IsPlayerConnected(i))
8051|           {
8052|               if (BusrouteEast[i][0] != 0 && BusrouteEast[i][1] == vehicleid)
8053|                   //BusrouteEast[i][2] --;
8054|                   GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~g~Passenger Left The Bus", 5000, 3);
8055|               else if (BusrouteWest[i][0] != 0 && BusrouteWest[i][1] == vehicleid)
8056|                   //BusrouteWest[i][2] --;
8057|                   GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~g~Passenger Left The Bus", 5000, 3);
8058|           }
8059|       }
8060|   }
8061|   return 1;
8062|}
Would be nice if you posted which lines actually give you the error.
Still error .

first linenumber is 7987 and last is 8062 .

error:

(8041) : warning 209: function "OnPlayerExitVehicle" should return a value
(8042) : error 010: invalid function or declaration
(8044) : warning 218: old style prototypes used with optional semicolumns
(8045) : error 054: unmatched closing brace ("}")
(8046) : error 010: invalid function or declaration
(804 : error 010: invalid function or declaration
(8050) : error 010: invalid function or declaration
(8052) : error 010: invalid function or declaration
(8054) : error 021: symbol already defined: "GameTextForPlayer"
(8055) : error 010: invalid function or declaration
(8057) : error 021: symbol already defined: "GameTextForPlayer"
(8061) : error 010: invalid function or declaration
Reply
#7

If you were writing more codes in public OnPlayerExitVehicle(playerid, vehicleid)
{
on top of it and did not close it you will get these errors

and for the "GameTextForPlayer" is already defined you just don't need it 2 times again alright? just put again the code in the last "GameTextForPlayer" and i think this should fix some errors
Reply
#8

Quote:
Originally Posted by yoan103
If you were writing more codes in public OnPlayerExitVehicle(playerid, vehicleid)
{
on top of it and did not close it you will get these errors

and for the "GameTextForPlayer" is already defined you just don't need it 2 times again alright? just put again the code in the last "GameTextForPlayer" and i think this should fix some errors
i think code must be ok but something is wrong.

How i defined it 2 times? its not define when i do

Код:
SetTimer("SmugglerExit", 7000, 0);
GameTextForPlayer(playerid, "~n~~w~You have ~r~7~w~ seconds~n~to get back in car", 5000, 3);

Ok Anyway i got it work , ty for answering.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)