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

Уроки по скриптингу

Moderator: SJplayer

Avatar
Topic author
Invi_Sasha M
Мл. сержант
Мл. сержант
Posts: 34
With us: 7 years 5 months

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

Post #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

Users browsing this forum: 1 guest