(Scr) Трансформация

Description: Готовые решения скриптов, filterScript
Moderator: SJplayer

SJplayer M
Topic author, Модератор
Модератор
Avatar
SJplayer M
Topic author, Модератор
Модератор
Posts: 196
Joined: 25 May 2013
With us: 11 years 4 months

#1by SJplayer » 3 Jul 2013, 11:22

(Scr) Трансформация
Автор: Fun4ik

Суть скрипта - если вы в машине ' Инфернус ' и ваша скорость больше 80км/ч, то при нажатии на кнопку ' Y ', ваша машина превращается в лодку и обратно.

Скрипт

Code: Select all

#include <a_samp>

#define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

new Car[MAX_PLAYERS];

public OnFilterScriptInit()
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_YES))
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 411 && GetVehicleSpeed(GetPlayerVehicleID(playerid)) >= 80)
        {
            new Float:pos[4],Float:speed;
            speed = GetVehicleSpeed(GetPlayerVehicleID(playerid));
            GetVehiclePos(GetPlayerVehicleID(playerid),pos[0],pos[1],pos[2]);
            GetVehicleZAngle(GetPlayerVehicleID(playerid),pos[3]);
            DestroyVehicle(GetPlayerVehicleID(playerid));
            Car[playerid] = AddStaticVehicleEx(452,pos[0],pos[1],pos[2],pos[3],1,1,99999999);
            PutPlayerInVehicle(playerid, Car[playerid], 0);
            SetVehicleSpeed(GetPlayerVehicleID(playerid),speed);
            SendClientMessage(playerid,-1,"Оптимус Прайм, ёпта :D");
        }
        else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 452 && GetVehicleSpeed(GetPlayerVehicleID(playerid)) <= 120)
        {
            new Float:pos[4],Float:speed;
            speed = GetVehicleSpeed(GetPlayerVehicleID(playerid));
            GetVehiclePos(GetPlayerVehicleID(playerid),pos[0],pos[1],pos[2]);
            GetVehicleZAngle(GetPlayerVehicleID(playerid),pos[3]);
            DestroyVehicle(GetPlayerVehicleID(playerid));
            Car[playerid] = AddStaticVehicleEx(411,pos[0],pos[1],pos[2],pos[3],1,1,99999999);
            PutPlayerInVehicle(playerid, Car[playerid], 0);
            SetVehicleSpeed(GetPlayerVehicleID(playerid),speed);
        }
    }
    return 1;
}

stock SetVehicleSpeed(vehicleid, Float:speed)
{
    new Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2, Float:a;
    GetVehicleVelocity(vehicleid, x1, y1, z1);
    GetVehiclePos(vehicleid, x2, y2, z2);
    GetVehicleZAngle(vehicleid, a); a = 360 - a;
    x1 = (floatsin(a, degrees) * (speed/100) + floatcos(a, degrees) * 0 + x2) - x2;
    y1 = (floatcos(a, degrees) * (speed/100) + floatsin(a, degrees) * 0 + y2) - y2;
    SetVehicleVelocity(vehicleid, x1, y1, z1);
}

stock GetVehicleSpeed(vehicleid)
{
    new Float:x, Float:y, Float:z;
    GetVehicleVelocity(vehicleid, x, y, z);
    return floatround(floatsqroot(x*x+y*y+z*z)*100);


Miranda F
Старшина
Старшина
Avatar
Miranda F
Старшина
Старшина
Posts: 143
Joined: 5 Jul 2013
With us: 11 years 3 months

#2by Miranda » 5 Jul 2013, 15:30

Чего только не придумают...
Image


Return to “Скрипты / FS”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest