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

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

Moderator: SJplayer

Avatar
Topic author
SJplayer M
Модератор
Модератор
Posts: 191
With us: 7 years 4 months

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

Post #1by SJplayer » 14 Aug 2013, 17:53

Управление автомобилем
Автор: Botan

Image


Простенькая система "Управление автомобилем".
Начнём:

В public OnPlayerCommandText(playerid, cmdtext[]) добавляем:

Code: Select all

if(strcmp(cmd"/amenu"true) == 0)
{
    if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER) return ShowPlayerDialog(playerid1005002,"Управление автомобилем","[1] Открыть багажник\n[2] Открыть капот\n[3] Включить фары\n[4] Включить сигнализацию\n{99ff99}[5] Закрыть багажник\n{99ff99}[6] Закрыть капот\n{99ff99}[7] Выключить фары\n{99ff99}[8] Выключить сигнализацию""Выбрать""Отмена");
    return 
true;
}  


У кого ZCMD:

Code: Select all

CMD:amenu(playeridparams[])
{
    if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER) return ShowPlayerDialog(playerid1005002"Управление автомобилем","[1] Открыть багажник\n[2] Открыть капот\n[3] Включить фары\n[4] Включить сигнализацию\n{99ff99}[5] Закрыть багажник\n{99ff99}[6] Закрыть капот\n{99ff99}[7] Выключить фары\n{99ff99}[8] Выключить сигнализацию""Выбрать""Отмена");
    return 
true;
}  


В public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) добавляем:

Code: Select all

case 100:
        {
            if(
response)
            {
                switch(
listitem)
                {
                case 
0// Открыть багажник
                    
{
                        
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
                        
SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,true,objective);
                    }
                case 
1// Открыть капот
                    
{
                        
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
                        
SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,true,boot,objective);
                    }
                case 
2// Включить фары
                    
{
                        
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
                        
SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,true,alarm,doors,bonnet,boot,objective);
                    }
                case 
3// Включить сигнализацию
                    
{
                        
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
                        
SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,true,doors,bonnet,boot,objective);
                    }
                case 
4// Закрыть багажник
                    
{
                        
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
                        
SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,false,objective);
                    }
                case 
5// Закрыть капот
                    
{
                        
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
                        
SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,false,boot,objective);
                    }
                case 
6// Выключить фары
                    
{
                        
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
                        
SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,false,alarm,doors,bonnet,boot,objective);
                    }
                case 
7// Выключить сигнализацию
                    
{
                        
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
                        
SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,false,doors,bonnet,boot,objective);
                    }
                }
            }
        }  

! ! !


  • Similar Topics
    Replies
    Views
    Last post

Return to “Уроки”

Who is online

Users browsing this forum: 1 guest