SA-MP Forums Archive
Please, can somebody say me where's the error? - 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: Please, can somebody say me where's the error? (/showthread.php?tid=94743)



Please, can somebody say me where's the error? - Hot - 31.08.2009

pawn Код:
if(strcmp(cmdtext, "/rent", true, 5) == 0)
    {
        new S = GetPlayerState(playerid);
    if(IsPlayerInVehicle(playerid, Hire_Able_Vehicle) && S (playerid) != PLAYER_STATE_PASSENGER)
        {
          if(GetPlayerMoney(playerid) > 75)
            {
            Owner[playerid] = 1; // He is the owner
            IsVehicleHasOwner = 1;
                SendClientMessage(playerid, 0xFFFFFFAA, "* You have successfully rented a vehicle, to unrent it, type '/unrent', Have a nice day!");
                GivePlayerMoney(playerid, -75);
                return true;
            }

      else return SendClientMessage(playerid, 0xFFFFFFAA, "* Not enough money.");
        }

        else return SendClientMessage(playerid, 0xFFFFFFAA, "* This vehicle is not available for rent. / You are not the vehicle driver.");
    }
Код:
C:\Documents and Settings\Usuario\Desktop\samp02Xserver.win32\gamemodes\bRP.pwn(276) : error 012: invalid function call, not a valid address
C:\Documents and Settings\Usuario\Desktop\samp02Xserver.win32\gamemodes\bRP.pwn(276) : warning 215: expression has no effect
C:\Documents and Settings\Usuario\Desktop\samp02Xserver.win32\gamemodes\bRP.pwn(276) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\Usuario\Desktop\samp02Xserver.win32\gamemodes\bRP.pwn(276) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Usuario\Desktop\samp02Xserver.win32\gamemodes\bRP.pwn(276) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
LINE 276:
Код:
if(IsPlayerInVehicle(playerid, Hire_Able_Vehicle) && S (playerid) != PLAYER_STATE_PASSNGER)
Help Please


Re: Please, can somebody say me where's the error? - Correlli - 31.08.2009

Change:
pawn Код:
if(IsPlayerInVehicle(playerid, Hire_Able_Vehicle) && S (playerid) != PLAYER_STATE_PASSENGER)
{
to:
pawn Код:
if(IsPlayerInVehicle(playerid, Hire_Able_Vehicle) && S != PLAYER_STATE_PASSENGER)
{
or:
pawn Код:
if(IsPlayerInVehicle(playerid, Hire_Able_Vehicle) && GetPlayerState(playerid) != PLAYER_STATE_PASSENGER)
{



Re: Please, can somebody say me where's the error? - Hot - 31.08.2009

Ok thanks, now work, but... When I enter in vehicle, it should freeze me, but it doesn't do nothing, don't even say the message programmed, take a look:

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  if(vehicleid == Hire_Able_Vehicle && Owner[playerid] == 1) return SendClientMessage(playerid, 0x00ffffff, "* Welcome to your vehicle!");

    if(vehicleid == Hire_Able_Vehicle) // Hey, he has entered our vehicle!
  {
    if(ispassenger) return true; // If he is passenger, we dont care, he might be driving with his friend.
    if(IsVehicleHasOwner == 0) SetupForBuy(playerid); // If the vehicle has NOT owner, lets set him
    else RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, 0xFFFFFFAA, "* This is a already-rented wehicle, so you have exited it."); // Else, the vehicle DOES has an owner, kick him from veh.
  }
  return true;
}
pawn Код:
public SetupForBuy(playerid)
{
  TogglePlayerControllable(playerid, false); // Freeze him.
  SendClientMessage(playerid, 0xFFFFFFAA, "* You have entered in a vehicle available for rent, type '/rent' to rent it, or /exit it.");
  return true;
}
Код:
Hire_Able_Vehicle = AddStaticVehicle(462,195.6086,-250.0696,1.1786,181.0117,1,1); // (Rental) Faggio
	Hire_Able_Vehicle = AddStaticVehicle(462,198.6086,-250.0696,1.1786,181.5403,1,1); // (Rental) Faggio
	Hire_Able_Vehicle = AddStaticVehicle(462,201.6086,-250.0696,1.1786,181.3488,1,1); // (Rental) Faggio
	Hire_Able_Vehicle = AddStaticVehicle(462,203.6086,-250.0696,1.1786,181.9874,1,1); // (Rental) Faggio
	Hire_Able_Vehicle = AddStaticVehicle(462,205.6086,-250.0696,1.1786,181.3377,1,1); // (Rental) Faggio
	Hire_Able_Vehicle = AddStaticVehicle(462,207.6086,-250.0696,1.1786,181.4246,1,1); // (Rental) Faggio
	Hire_Able_Vehicle = AddStaticVehicle(462,209.6086,-250.0696,1.1786,181.0979,1,1); // (Rental) Faggio
	Hire_Able_Vehicle = AddStaticVehicle(462,211.6086,-250.0696,1.1786,181.3469,1,1); // (Rental) Faggio
Any ideas why?


Re: Please, can somebody say me where's the error? - ilikepie2221 - 31.08.2009

I dont think you're allowed to assign multiple vehicles the same ID.


Re: Please, can somebody say me where's the error? - ilikepie2221 - 31.08.2009

Which is why you'll need to do

pawn Код:
Hire_Able_Vehicle1 = // function
Hire_Able_Vehicle2 = // function
So on and so forth.