Imortal Vehicle & People problem
#1

Im makeing a stunt server ( this is the 3th time i change gamemode XD ) so
id like that you cant die and your vehicle cant
i tried this ( i have alot 3 000 lines in my gamemode im not saying em!) :
[pawn]
// This is at the top of the gamemode
#include <a_samp>
// STUNT - FUNCTIONS
forward ImortalVehicle(playerid,vehicleid);
forward ImortalPerson(playerid);

public ImortalVehicle();
{
new Float:HP;
for(new i=0;i<MAX_PLAYERS;i++)
{
if (IsPlayerInAnyVehicle(i))
{
for(new v=0;v<MAX_VEHICLES;v++)
{
GetVehicleHealth(v,Float:HP);
if(Float:HP < 1000)
{
SetVehicleHealth(v,1000);
}
}
}
}
}

public ImortalPerson();
{
new Float:HP;
for(new i=0;i<MAX_PLAYERS;i++)
{
if (GetPlayerHealth(i) < 100)
{
SetPlayerHealth(i, 100);
}
}
}

[pawn]

after the forwards i have set the timers :
pawn Код:
SetTimer(ImortalPerson,100,true);
SetTimer(ImortalVehicle,100,true);
when i got ingame ( i set this for a test ) :
pawn Код:
public OnPlayerSpawn(playerid)
{
   SetPlayerHealth(playerid,1);
   return 1;
}
compiled succesfully
it didnt work
i tryed to add the timers in OnGameModeInit :

pawn Код:
public OnGameModeInit()
{
   SetTimer(ImortalPerson,100,true);
   SetTimer(ImortalVehicle,100,true);
   return 1;
}
i got some errors in OnGameModeInit

Код:
C:\Users\Mihailo\Desktop\Script Test Server\gamemodes\gm.pwn(110) : error 017: undefined symbol "ImortalPerson"
C:\Users\Mihailo\Desktop\Script Test Server\gamemodes\gm.pwn(111) : error 017: undefined symbol "ImortalVehicle"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
put it didnt work with the not in gamemodeinit

however

i understood these errors but this is what i got when i puted the public functions at the end of my script
Код:
C:\Users\Mihailo\Desktop\Script Test Server\gamemodes\gm.pwn(80) : error 076: syntax error in the expression, or invalid function call
C:\Users\Mihailo\Desktop\Script Test Server\gamemodes\gm.pwn(81) : error 076: syntax error in the expression, or invalid function call
C:\Users\Mihailo\Desktop\Script Test Server\gamemodes\gm.pwn(1508) : error 055: start of function body without function header
C:\Users\Mihailo\Desktop\Script Test Server\gamemodes\gm.pwn(1510) : error 010: invalid function or declaration
C:\Users\Mihailo\Desktop\Script Test Server\gamemodes\gm.pwn(1512) : error 010: invalid function or declaration
C:\Users\Mihailo\Desktop\Script Test Server\gamemodes\gm.pwn(1514) : error 010: invalid function or declaration
C:\Users\Mihailo\Desktop\Script Test Server\gamemodes\gm.pwn(1517) : error 010: invalid function or declaration
C:\Users\Mihailo\Desktop\Script Test Server\gamemodes\gm.pwn(1527) : error 055: start of function body without function header
C:\Users\Mihailo\Desktop\Script Test Server\gamemodes\gm.pwn(1528) : error 021: symbol already defined: "HP"
C:\Users\Mihailo\Desktop\Script Test Server\gamemodes\gm.pwn(1529) : error 010: invalid function or declaration
C:\Users\Mihailo\Desktop\Script Test Server\gamemodes\gm.pwn(1531) : error 010: invalid function or declaration
C:\Users\Mihailo\Desktop\Script Test Server\gamemodes\gm.pwn(1538) : warning 203: symbol is never used: "HP"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


11 Errors.
anyone please help me i wood apruciate it
Reply
#2

pawn Код:
SetTimer("ImortalPerson",100,true);
   SetTimer("ImortalVehicle",100,true);

public ImortalVehicle() ; no


pawn Код:
forward ImortalVehicle();
public ImortalVehicle()
{
  //func.....
  return 1;
}
pawn Код:
#include <a_samp>

//public OnGameModeInit()
public OnFilterScriptInit()
{
    SetTimer("godplayerorvehicle",1000,true);
    return 1;
}

forward godplayerorvehicle();
public godplayerorvehicle()
{
    new
        MaxPlayers = GetMaxPlayers();
    for(new i; i < MaxPlayers; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        new
            Float:HP,
            VehicleID = GetPlayerVehicleID(i);
        if(VehicleID)
        {
            GetVehicleHealth(VehicleID, HP);
            if(HP < 500) { RepairVehicle(VehicleID); }
        } else {
            GetPlayerHealth(i, HP);
            if(HP < 99) { SetPlayerHealth(i, 100); }
        }
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Phento
pawn Код:
SetTimer("ImortalPerson",100,true);
   SetTimer("ImortalVehicle",100,true);

public ImortalVehicle() ; no


pawn Код:
forward ImortalVehicle();
public ImortalVehicle()
{
  //func.....
  return 1;
}

still not working ....
i came ingame and i didnt re-heal
Reply
#4

pawn Код:
forward ImortalPerson();
pawn Код:
public ImortalPerson()
{
  new Float:HP,
    vehicleid;

  for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
  {
    if(!IsPlayerConnected(playerid)) continue;

    GetPlayerHealth(playerid, HP);

    if(HP < 100.0)
    {
      SetPlayerHealth(playerid, 100.0);
    }
   
    if(IsPlayerInAnyVehicle(playerid))
    {
      vehicleid = GetPlayerVehicleID(playerid);

      GetVehicleHealth(vehicleid, HP);

      if(HP < 1000.0)
      {
        SetVehicleHealth(vehicleid, 1000.0);
      }
    }
  }
  return 1;
}
pawn Код:
public OnGameModeInit()
{
  SetTimer("ImortalPerson", 1000, true);
}
Reply
#5

Quote:
Originally Posted by Finn
pawn Код:
forward ImortalPerson();
pawn Код:
public ImortalPerson()
{
  new Float:HP,
    vehicleid;

  for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
  {
    if(!IsPlayerConnected(playerid)) continue;

    GetPlayerHealth(playerid, HP);

    if(HP < 100.0)
    {
      SetPlayerHealth(playerid, 100.0);
    }
   
    if(IsPlayerInAnyVehicle(playerid))
    {
      vehicleid = GetPlayerVehicleID(playerid);

      GetVehicleHealth(vehicleid, HP);

      if(HP < 1000.0)
      {
        SetVehicleHealth(vehicleid, 1000.0);
      }
    }
  }
  return 1;
}
pawn Код:
public OnGameModeInit()
{
  SetTimer("ImortalPerson", 1000, true);
}
errors :
Код:
C:\Users\Mihailo\Desktop\Script Test Server\gamemodes\gm.pwn(1519) : warning 235: public function lacks forward declaration (symbol "ImortalVehicle")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
what does this error mean?
Reply
#6

Remove the public ImortalVehicle.
Reply
#7

Quote:
Originally Posted by Finn
Remove the public ImortalVehicle.
i dont get it remove public or the hole function!? witch i need
Reply
#8

Whole function.
Reply
#9

Quote:
Originally Posted by Micko9
Quote:
Originally Posted by Finn
Remove the public ImortalVehicle.
i dont get it remove public or the hole function!? witch i need
You can add
Код:
forward ImortalVehicle(vehicleid);
But you don't need the ImortalVehicle public,just remove it.
Reply
#10

Quote:
Originally Posted by Kartowka
Quote:
Originally Posted by Micko9
Quote:
Originally Posted by Finn
Remove the public ImortalVehicle.
i dont get it remove public or the hole function!? witch i need
You can add
Код:
forward ImortalVehicle(vehicleid);
But you don't need the ImortalVehicle public,just remove it.
i dont understand when i remove the "public" word is says me this error
Код:
C:\Users\Mihailo\Desktop\Script Test Server\gamemodes\gm.pwn(1549) : warning 203: symbol is never used: "ImortalVehicle"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)