Need help about script
#1

how i can get nearest airport??

Код:
if(strcmp(cmdtext, "/work", true) == 0)
        {
            if (GetPVarInt(playerid, "Flight") == 1)
            {
                return SendClientMessage(playerid, COLOR_RED, "You are already in a flight!");
                }

                if (GetPVarInt(playerid, "Work") > 0)
                {
                    return SendClientMessage(playerid, COLOR_RED, "You are already in a work!");
                }


                new IslandName[48], szString[128];
                SetPVarInt(playerid, "Work", 1);
                MissionVehicle[playerid] = GetPlayerVehicleID(playerid);
                switch (random(12))
                {
                    case 0: {
                    Island[PopCorn_Island][playerid]=SetPlayerFlightCheckpoint(playerid, 3364.3716,187.7556,3.7580, 10.0);
                    IslandName="PopCorn Island"; }
                    case 1: {
                    Island[Las_Venturas][playerid]=SetPlayerFlightCheckpoint(playerid, 1476.5433,1465.9758,10.8281, 10.0);
                    IslandName="Las Venturas"; }
                    case 2: {
                    Island[Island_1][playerid] = SetPlayerFlightCheckpoint(playerid, -3573.7981,-313.6209,12.8887, 10.0);
                    IslandName="Island 1"; }
                    case 3: {
                    Island[Los_Santos][playerid] = SetPlayerFlightCheckpoint(playerid, 1869.8599,-2493.2256,13.5547, 10.0);
                    IslandName="Los Santos"; }
                    case 4: {
            Island[San_Fierro][playerid] = SetPlayerFlightCheckpoint(playerid, -1437.0648,48.4609,14.1484, 10.0);
            IslandName="San Fierro"; }
            case 5: {
            Island[Verdant_Meadows][playerid] = SetPlayerFlightCheckpoint(playerid, 270.4283,2507.4309,16.4944, 10.0);
            IslandName="Verdant Meadows"; }
            case 6: {
            Island[Pilot_Island][playerid] = SetPlayerFlightCheckpoint(playerid, -84.6720,3357.0527,4.2387, 10.0);
            IslandName="Pilots Island"; }
            case 7: {
            Island[Admin_Island][playerid] = SetPlayerFlightCheckpoint(playerid, 818.3096,-4558.7163,1.2266, 10.0);
            IslandName="Admin Island"; }
            case 8: {
            Island[PopCorn_Mansion][playerid] = SetPlayerFlightCheckpoint(playerid, 3275.1458,-1819.7595,2.0000, 10.0);
            IslandName="PopCorn Island"; }
            case 9: {
            Island[Rock_Island][playerid] = SetPlayerFlightCheckpoint(playerid, 3428.0107,-683.0929,4.4299, 10.0);
            IslandName="Rock Island"; }
            case 10: {
            Island[Bubbles_Island][playerid] = SetPlayerFlightCheckpoint(playerid, 5798.8726,-1556.8759,4.9581, 10.0);
            IslandName="Bubbles Island"; }
            case 11: {
                        Island[Communist_AP][playerid] = SetPlayerFlightCheckpoint(playerid, -1481.1166,3129.1453,19.3932, 10.0);
                        IslandName="Communist Airport"; }
                }

                FirstAPName[playerid] = IslandName;
                format(szString, 128, "Go to %s to pick up the passengers!", IslandName);

        WorkTimer[playerid] = SetTimerEx("WorkingMinutes", 60000, true, "i", playerid);
                SendClientMessage(playerid, COLOR_LIGHTGREEN, szString);
              return 1;
        }
Reply
#2

Add this somewhere in cmd.
pawn Код:
if(IsPlayerInRangeOfPoint(playerid,1,X,Y,Z))
Reply
#3

what you mean
Reply
#4

it checks if a player is in range of a point.

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)
{
// do something here
}
Reply
#5

Quote:
Originally Posted by XtremeR
Посмотреть сообщение
it checks if a player is in range of a point.

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)
{
// do something here
}
Thanks for fully explain.

[EDIT] @ejul Gimme that position you want player will be around to do that cmd.
Reply
#6

Xtremer.. do you tested the code? ..
it gives this errors
pawn Код:
E:\samp03e_svr_win32\gamemodes\COD1.pwn(837) : error 017: undefined symbol "range"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Tip: Learn coding yourself .. will be better than asking to create your self.. anyways.
This function must be used in this case: IsPlayerInRangeOfPoint

And the usage will be .. Example only (don't add following.. its just an example usage).
pawn Код:
If(IsPlayerInRangeOfPoint(playerid, 20.0,/*Your airport co-ordinates X, Y, Z */)
{
  //Your codes
}
else If(IsPlayerInRangeOfPoint(playerid, 20.0,/*Your airport co-ordinates X, Y, Z */)
{
  //Your codes
}
Do the above thing under your command. . it will check if the player is in range of the cords you specify..
If he is not then use SendClientMessage
To stop him using the command.
Reply
#7

Guys Like This


Код:
           if(IsPlayerInRangeOfPoint(playerid, 20.0,1869.8599,-2493.2256,13.5547)
                    {
                    Island[Los_Santos][playerid] = SetPlayerFlightCheckpoint(playerid, 1869.8599,-2493.2256,13.5547, 10.0);
                    IslandName="Los Santos";
					}
                   else if(IsPlayerInRangeOfPoint(playerid, 20.0,-1437.0648,48.4609,14.1484)
				    {
                    Island[San_Fierro][playerid] = SetPlayerFlightCheckpoint(playerid, -1437.0648,48.4609,14.1484, 10.0);
                    IslandName="San Fierro";
					 }
               
                           
                    else if(IsPlayerInRangeOfPoint(playerid, 20.0,1476.5433,1465.9758,10.8281)
				    {
                    Island[Las_Venturas][playerid]=SetPlayerFlightCheckpoint(playerid, 1476.5433,1465.9758,10.8281, 10.0);
                    IslandName="Las Venturas";
					}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)