1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. GTA Network forum is now in archive mode.

SAMP функції PlayerToPlayer та PlayerToPoint

Discussion in 'Українська/Ukrainian' started by Gnatovskyi, Jan 30, 2017.

  1. Gnatovskyi

    Gnatovskyi Member

    Messages:
    5
    Likes Received:
    2
    Joined:
    Jan 28, 2017
    Доброго дня. Представляю вам дві функції:
    1. Для контролю позиції гравця з певним місцем знаходження;
    2. Для контролю позиції гравця з позицією другого гравця.
    Code:
    public bool PlayerToPoint(float radius, Client player, Vector3 pos)
        {
        return (radius<=player.position.DistanceTo(pos)) ? false : true;
        }
    
    Code:
    public bool PlayerToPlayer(float radius, Client player, Client giveplayer)
        {
        return (radius<=player.position.DistanceTo(giveplayer.position)) ? false : true;
        }
    Code:
    [Command("repair", GreedyArg=true)]
        public void VehicleRepairCommand(Client player, Client giveplayer){
        if (PlayerToPoint(10, player, new Vector3(116.9309,6620.834,31.41387)) && PlayerToPoint(2, giveplayer, new Vector3(116.9309,6620.834,31.41387)))
        {
        if (API.isPlayerInAnyVehicle(giveplayer)){
            NetHandle veh = API.getPlayerVehicle(giveplayer);
            API.repairVehicle(veh);}
        }}
     

Share This Page