Оружейный завод (Сборщик оружия)

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

Moderator: SJplayer

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

Оружейный завод (Сборщик оружия)

Post #1by SJplayer » 1 Jun 2013, 17:08

Оружейный завод (Сборщик оружия)
Автор: S.Colt

Ко всем new:

Code: Select all

new gunjob;


Ко всем forward:

Code: Select all

forward Gunjobanim(playerid);


Ко всем #define:

Code: Select all

#define COLOR_ORANGE        0xFFA500AA 
#define COLOR_WHITE         0xFFFFFFAA 
#define COLOR_LIGHTGREEN    0x9ACD32AA 
#define GCASH           25//Зар.плата за 1ед. оружия. 
#define D_GUNJOB        7//ID диалога устройства на работу (сменить на доступный). 
#define D_GUNCJOB       8//ID диалога завершения работы (сменить на доступный).   


В public OnGameModeInit():

Code: Select all

gunjob = CreatePickup(1275,23,-2157.5566,-228.0305,36.5156,-1);//Pickup устройства на работу.   


В public OnPlayerEnterCheckpoint(playerid):

Code: Select all

if(GetPVarInt(playerid, "Gjob") == 1) 
    
{ 
        ApplyAnimation
(playerid,"CARRY","crry_prtial",4.1,0,1,1,1,1); 
        SetPlayerAttachedObject
(playerid,3,2969,1,0.075578,0.407083,0.000000,1.248928,97.393852,359.645050,1.000000,1.000000,1.000000); 
        SendClientMessage
(playerid, COLOR_LIGHTGREEN, "Следуйте к вашему рабочему столу."); 
        new gcheck 
= random(6); 
        if
(gcheck == 0) SetPlayerCheckpoint(playerid,-2174.8140,-248.9825,36.5156,1.5); 
        if
(gcheck == 1) SetPlayerCheckpoint(playerid,-2171.2725,-248.9854,36.5156,1.5); 
        if
(gcheck == 2) SetPlayerCheckpoint(playerid,-2167.7622,-248.9828,36.5156,1.5); 
        if
(gcheck == 3) SetPlayerCheckpoint(playerid,-2164.0132,-248.9834,36.5156,1.5); 
        if
(gcheck == 4) SetPlayerCheckpoint(playerid,-2160.7185,-248.9828,36.5156,1.5); 
        if
(gcheck == 5) SetPlayerCheckpoint(playerid,-2157.0967,-248.9832,36.5156,1.5); 
        SetPVarInt
(playerid, "Gjob",2); 
        return 1
; 
    
} 
    if
(GetPVarInt(playerid, "Gjob") == 2) 
    
{ 
        DisablePlayerCheckpoint
(playerid); 
        RemovePlayerAttachedObject
(playerid,3); 
        ClearAnimations
(playerid); 
        ApplyAnimation
(playerid, "BUDDY", "buddy_reload", 4.1, 1, 1, 1, 1, 0); 
          SetPlayerAttachedObject
(playerid,3,355,14,0.401943,0.011442,0.010348,106.050292,330.509094,3.293162,1.000000,1.000000,1.000000); 
          SetTimerEx
("Gunjobanim", 7000, false, "i", playerid); 
        return 1
; 
    
} 
    if
(GetPVarInt(playerid, "Gjob") == 3) 
    
{ 
        RemovePlayerAttachedObject
(playerid,3); 
        ApplyAnimation
(playerid,"PED","IDLE_tired",4.1,0,1,1,0,1); 
        SetPVarInt
(playerid,"GUN",GetPVarInt(playerid,"GUN")+1); 
        new string 
[128]; 
        format
(string,sizeof(string),"Оружия собрано: {9ACD32}%d {FFFFFF}ед.",GetPVarInt(playerid,"GUN")); 
        SendClientMessage
(playerid,COLOR_WHITE,string); 
        SetPVarInt
(playerid,"Gjob",1); 
        new mcheck 
= random(3); 
        if
(mcheck == 0) SetPlayerCheckpoint(playerid,-2155.2200,-264.5011,36.5156,1.5); 
        if
(mcheck == 1) SetPlayerCheckpoint(playerid,-2158.8135,-264.5027,36.5156,1.5); 
        if
(mcheck == 2) SetPlayerCheckpoint(playerid,-2162.2893,-264.5027,36.5156,1.5); 
        return 1
; 
     
}


В public OnPlayerPickUpPickup(playerid, pickupid):

Code: Select all

if(pickupid == gunjob) 
    
{ 
        if
(GetPVarInt(playerid, "Gunjob") == 0) ShowPlayerDialog(playerid, D_GUNJOB, 0, "Сборщик оружия", "Вы действительно хотите начать работу?", "Да", "Нет"); 
        else ShowPlayerDialog
(playerid, D_GUNCJOB, 0, "Сборщик оружия", "Вы действительно хотите завершить работу?", "Да", "Нет");


В public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]):

Code: Select all

if(dialogid == D_GUNJOB) 
    
{ 
        if
(!response) return 1; 
        SetPVarInt
(playerid, "GSkin",GetPlayerSkin(playerid)); 
        new gskin 
= random(2); 
        if
(gskin == 0) SetPlayerSkin(playerid, 258); 
        if
(gskin == 1) SetPlayerSkin(playerid, 259); 
        SendClientMessage
(playerid,COLOR_ORANGE,"Вы начали работу сборщика оружия. Следуйте к столу, чтобы взять ящик с металлом."); 
        SetPVarInt
(playerid,"Gunjob",1); 
        SetPVarInt
(playerid,"Gjob",1); 
        new mcheck 
= random(3); 
        if
(mcheck == 0) SetPlayerCheckpoint(playerid,-2155.2200,-264.5011,36.5156,1.5); 
        if
(mcheck == 1) SetPlayerCheckpoint(playerid,-2158.8135,-264.5027,36.5156,1.5); 
        if
(mcheck == 2) SetPlayerCheckpoint(playerid,-2162.2893,-264.5027,36.5156,1.5); 
        return 1
; 
    
} 
    if
(dialogid == D_GUNCJOB) 
    
{ 
        if
(!response) return 1; 
        new string
[128]; 
        SetPlayerSkin
(playerid, GetPVarInt(playerid, "GSkin")); 
        format
(string, 50,"Вы закончили работу. Заработано: %i долларов.",GetPVarInt(playerid, "GUN")*GCASH); 
        SendClientMessage
(playerid,COLOR_ORANGE,string); 
        GivePlayerMoney
(playerid,GetPVarInt(playerid, "GUN")*GCASH);//GivePlayerMoney замените на свою систему выдачи денег. 
         RemovePlayerAttachedObject(playerid, 3); 
        DeletePVar
(playerid, "Gunjob"); 
        DeletePVar
(playerid, "GUN"); 
        DeletePVar
(playerid, "Gjob"); 
        DeletePVar
(playerid, "GSkin"); 
        DisablePlayerCheckpoint
(playerid); 
        return 1
; 
    
} 


 В конец мода
: 
public Gunjobanim
(playerid) 
{ 
    RemovePlayerAttachedObject
(playerid,3); 
    ApplyAnimation
(playerid,"PED","IDLE_tired",4.1,0,1,1,0,1); 
    ApplyAnimation
(playerid,"CARRY","crry_prtial",4.1,0,1,1,1,1); 
     SetPlayerAttachedObject
(playerid,3,2969,1,0.075578,0.407083,0.000000,1.248928,97.393852,359.645050,1.000000,1.000000,1.000000); 
    SetPVarInt
(playerid, "Gjob",3); 
    SendClientMessage
(playerid, COLOR_LIGHTGREEN, "Оружие собрано. Следуйте к складу."); 
    SetPlayerCheckpoint
(playerid,-2163.6130,-230.5670,36.5156,1.5); 
    return 1
; 
}


Расположение завода

Image

! ! !


  • Similar Topics
    Replies
    Views
    Last post

Return to “Уроки”

Who is online

Users browsing this forum: 2 guests