IsPlayerInPlane
#1

Ok, so I'm making a Early Warning System for aircraft using timers. This is my first time using a timer to. :S . And it needs to check if the health is under 200. And if it is. Its displays a message.

Now, what I want is a IsPlayerInPlane function, but this is not been made yet (so I believe).

Can anyone please post something what would work like a IsPlayerInPlane function? Or if there is a include what has this function.

Thanks.

TK100
Reply
#2

Not hard to do..

pawn Код:
forward IsPlayerInPlane(playerid);
public IsPlayerInPlane(playerid)
{
 new vid, vmd;
 vid = GetPlayerVehicleID(playerid);
 vmd = GetPlayerVehicleModel(vid);
 switch(vmd)
 {
  case /* plane id here */ : return true;
 }
 reutrn false;
}
** Not tested and i didn't even work hard on this. May have or be bugged **
Reply
#3

Quote:
Originally Posted by techkid100
Посмотреть сообщение
Now, what I want is a IsPlayerInPlane function, but this is not been made yet (so I believe).

Can anyone please post something what would work like a IsPlayerInPlane function? Or if there is a include what has this function.

Thanks.

TK100
pawn Код:
stock IsAFlyingVehicle(vehicleid)
{
  switch(GetVehicleModel(vehicleid))
  {
    case
        460,464,476,511,512,513,519,520,553,577,592,593,//flying vehicle models
        417,425,447,465,469,487,488,497,501,548,563:
    return true;
  }
  return false;
}
Adjust to suit your needs.
Reply
#4

Any vehicle burns/explodes if their health goes below 250 - so you may want to check if the health is lower than 300 or 400
Reply
#5

Yeah see....my function was a piece of shit lol
Reply
#6

0.o, this is all so confusing. I will post the code soon.
Reply
#7

Quote:
Originally Posted by Steven82
Посмотреть сообщение
Yeah see....my function was a piece of shit lol
your function may have been shitty but your signature is plain awesome
Reply
#8

here we go (with Stigg's function)
pawn Код:
public OnGameModeInit()
{
    SetTimer("CheckAircrafts", 500, true);
    return 1;
}

forward CheckAircrafts();
public CheckAircrafts()
{
    for(new i=0; i<GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
        {
            if(IsAFlyingVehicle(GetPlayerVehicleID(playerid)))
            {
                new Float:hp;
                GetVehicleHealth(GetPlayerVehicleID(playerid), hp);
                if(hp < 200)
                {
                    YOUR WARN CODE HERE
                }
            }
        }
    }
    return 1;
}

stock IsAFlyingVehicle(vehicleid)
{
  switch(GetVehicleModel(vehicleid))
  {
    case
        460,464,476,511,512,513,519,520,553,577,592,593,//flying vehicle models
        417,425,447,465,469,487,488,497,501,548,563:
    return true;
  }
  return false;
}
Reply
#9

pawn Код:
#include <a_samp>
#include <a_colors>
#include <JunkBuster>

public OnGameModeInit()
{
    SetTimer("CheckAircrafts", 500, true);
    return 1;
}

forward CheckAircrafts();
public CheckAircrafts()
{
    for(new i=0; i<GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
        {
            if(IsAFlyingVehicle(GetPlayerVehicleID(playerid)))
            {
                new Float:hp;
                GetVehicleHealth(GetPlayerVehicleID(playerid), hp);
                if(hp < 450)
                {
                    GameTextForPlayer(playerid, 3, 10000, "~R~CRITICAL FAILURE!");
                    SendClientMessage(playerid, COLOR_RED, "ENGINE FAILURE! MAKE AN ERMGENCY LANDING WITH /ELAND!")
                }
            }
        }
    }
    return 1;
}

stock IsAFlyingVehicle(vehicleid)
{
  switch(GetVehicleModel(vehicleid))
  {
    case
        460,464,476,511,512,513,519,520,553,577,592,593,//flying vehicle models
        417,425,447,465,469,487,488,497,501,548,563:
    return true;
  }
  return false;
}
=

Код:
C:\Documents and Settings\Ed\My Documents\SAMP Server TKFS\filterscripts\EWS.pwn(18) : error 017: undefined symbol "playerid"
C:\Documents and Settings\Ed\My Documents\SAMP Server TKFS\filterscripts\EWS.pwn(21) : error 017: undefined symbol "playerid"
C:\Documents and Settings\Ed\My Documents\SAMP Server TKFS\filterscripts\EWS.pwn(24) : error 017: undefined symbol "playerid"
C:\Documents and Settings\Ed\My Documents\SAMP Server TKFS\filterscripts\EWS.pwn(25) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Wtf?

Thanks for the code to! Mine was filled with so many more errors.
Reply
#10

pawn Код:
#include <a_samp>
#include <a_colors>
#include <JunkBuster>

public OnGameModeInit()
{
    SetTimer("CheckAircrafts", 500, true);
    return 1;
}

forward CheckAircrafts();
public CheckAircrafts()
{
    for(new i=0; i<GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
        {
            if(IsAFlyingVehicle(GetPlayerVehicleID(i)))
            {
                new Float:hp;
                GetVehicleHealth(GetPlayerVehicleID(i), hp);
                if(hp < 450)
                {
                    GameTextForPlayer(i, 3, 10000, "~R~CRITICAL FAILURE!");
                    SendClientMessage(i, COLOR_RED, "ENGINE FAILURE! MAKE AN ERMGENCY LANDING WITH /ELAND!")
                }
            }
        }
    }
    return 1;
}
This should do it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)