Управление автомобилем Advance Rp.

Description: Уроки по скриптингу
Moderator: SJplayer

Invi_Sasha M
Topic author, Мл. сержант
Мл. сержант
Avatar
Invi_Sasha M
Topic author, Мл. сержант
Мл. сержант
Reputation: 1
Posts: 34
Joined: 20 May 2013
With us: 6 years 2 months

#1by Invi_Sasha » 22 May 2013, 22:05

Здравствуйте пользователи форума.
Сейчас я покажу вам как сделать управление транспортом как на Advance Rp.
И так начнём:

Создадим две переменные, багажник и капот.

Code: Select all

new bagajnik[MAX_VEHICLES]; 
new 
kapot[MAX_VEHICLES];   

В public OnPlayerConnect(playerid) добавляем:

Code: Select all

bagajnik[GetPlayerVehicleID(playerid)] =                         false
    
kapot[GetPlayerVehicleID(playerid)] =                         false;   

В public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) мы добавляем:

Code: Select all

if(newkeys KEY_ANALOG_UP) return SPD(playerid224DIALOG_STYLE_MSGBOX" ","\t{d8a903}Управление авто","Багажник","Капот");   

И после в

Code: Select all

case 224
        { 
            if(
response
            { 
                new 
carid GetPlayerVehicleID(playerid); 
                if(
bagajnik[carid] == 0
                { 
                    
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective); 
                    
SetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,true,objective); 
                    
bagajnik[carid] = 1
                } 
                else 
                { 
                    
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective); 
                    
SetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,false,objective); 
                    
bagajnik[carid] = 0
                } 
            } 
            else 
            { 
                new 
carid GetPlayerVehicleID(playerid); 
                if(
kapot[carid] == 0
                { 
                    
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective); 
                    
SetVehicleParamsEx(carid,engine,lights,alarm,doors,true,boot,objective); 
                    
kapot[carid] = 1
                } 
                else 
                { 
                    
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective); 
                    
SetVehicleParamsEx(carid,engine,lights,alarm,doors,false,boot,objective); 
                    
kapot[carid] = 0
                } 
            } 
             
        }   

Ну вот и всё, мы сделали управление авто как на Advance Rp.

Автор: Chupa

! ! !


  • Similar Topics
    Replies
    Views
    Last post

Return to “Уроки”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest