Выдать игроку объект

Готовые команды

Moderator: SJplayer

Avatar
Topic author
Дим M
Администратор
Администратор
Posts: 1319
With us: 7 years 5 months

Выдать игроку объект

Post #1by Дим » 6 May 2013, 19:11

Выдать игроку объект
Автор: Биляш

phpBB [media]


Скриншоты
Image

Image

Делалось под RLS

Ко всем new:

Code: Select all

new objectplayerid


В public OnPlayerCommandText

Code: Select all

else if(strcmp(cmd, "/object", true) == 0)
    {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return     SendClientMessage(playerid, COLOR_BLUE, "Используйте команду: {ffffff}/object [PlayerID]");
            objectplayerid = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            if(PlayerInfo[playerid][pAdmin] >= 7)
            {
                if(IsPlayerConnected(objectplayerid))
                {
                    if(objectplayerid != INVALID_PLAYER_ID)
                    {
                        ShowPlayerDialog(playerid,8000,DIALOG_STYLE_LIST,"Выдать объект игроку","[1] - Шляпа курицы\n[2] - Огонек на голову\n[3] - Мигалка на голову\n[4] - Черная маска\n[5] - Бандана №1\n[6] - Бандана №2\n[7] - Бандана №3\n[8] - Бандана №4\n[9] - Бандана №5\n[10] - Маска дракона\n[11] - Лазер на голову\n[12] - Комплект всемогущий\n[13] - Попугай на плечо\n[14] - Яркий свет\n[15] - Большой М4 в руку\n[16] - Пенис\n[17] - Костюм попугая\n[18] - Удалить все объекты","Выбрать","Закрыть");
                    }
                }
            }
    


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

Code: Select all

case 8000:
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                new sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], bilyash1[128],bilyash2[128];
                GetPlayerName(objectplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                if(IsPlayerAttachedObjectSlotUsed(objectplayerid, 2)) RemovePlayerAttachedObject(objectplayerid, 2);
                SetPlayerAttachedObject(objectplayerid,2,19137,2,0.100000,0.000000,0.000000,0.000000,0.000000,0.000000,1.000000,1.000000,1.000000);
                   format(bilyash1,sizeof(bilyash1),"Администратор %s выдал вам объект [Шляпа Курицы]",sendername);
                 format(bilyash2,sizeof(bilyash2),"[Adm] Вы выдали объект игроку %s [Шляпа Курицы]",giveplayer);
                SendClientMessage(objectplayerid, COLOR_BLUE,bilyash1);
                SendClientMessage(playerid, COLOR_BLUE, bilyash2);
                   return 1;
                }
                case 1:
                {
                new sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], bilyash1[128],bilyash2[128];
                GetPlayerName(objectplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                if(IsPlayerAttachedObjectSlotUsed(objectplayerid, 7)) RemovePlayerAttachedObject(objectplayerid, 7);
                   SetPlayerAttachedObject(objectplayerid,7, 19270, 2, 0.111052, 0.021643, -0.000846, 92.280899, 92.752510, 358.071044, 1.200000, 1.283168, 1.200000);
                format(bilyash1,sizeof(bilyash1),"Администратор %s выдал вам объект [Огонь на голову]",sendername);
                 format(bilyash2,sizeof(bilyash2),"[Adm] Вы выдали объект игроку %s [Огонь на голову]",giveplayer);
                SendClientMessage(objectplayerid, COLOR_BLUE,bilyash1);
                SendClientMessage(playerid, COLOR_BLUE, bilyash2);
                   return 1;
                }
                case 2:
                {
                new sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], bilyash1[128],bilyash2[128];
                GetPlayerName(objectplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                if(IsPlayerAttachedObjectSlotUsed(objectplayerid, 4)) RemovePlayerAttachedObject(objectplayerid, 4);
                   SetPlayerAttachedObject(objectplayerid,4, 18646, 2, 0.111052, 0.021643, -0.000846, 92.280899, 92.752510, 358.071044, 1.200000, 1.283168, 1.200000);
                format(bilyash1,sizeof(bilyash1),"Администратор %s выдал вам объект [Мигалка на голову]",sendername);
                 format(bilyash2,sizeof(bilyash2),"[Adm] Вы выдали объект игроку %s [Мигалка на голову]",giveplayer);
                SendClientMessage(objectplayerid, COLOR_BLUE,bilyash1);
                SendClientMessage(playerid, COLOR_BLUE, bilyash2);
                   return 1;
                   }
                case 3:
                {
                new sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], bilyash1[128],bilyash2[128];
                GetPlayerName(objectplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                if(IsPlayerAttachedObjectSlotUsed(objectplayerid, 7)) RemovePlayerAttachedObject(objectplayerid, 7);
                SetPlayerAttachedObject(objectplayerid,7, 19163, 2, 0.111052, 0.021643, -0.000846, 100.280899, 100.752510, 445.071044, 1.100000, 1.300000, 1.300000);
                format(bilyash1,sizeof(bilyash1),"Администратор %s выдал вам объект [Черная маска]",sendername);
                 format(bilyash2,sizeof(bilyash2),"[Adm] Вы выдали объект игроку %s [Черная маска]",giveplayer);
                SendClientMessage(objectplayerid, COLOR_BLUE,bilyash1);
                SendClientMessage(playerid, COLOR_BLUE, bilyash2);
                   return 1;
                   }
                case 4:
                {
                new sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], bilyash1[128],bilyash2[128];
                GetPlayerName(objectplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                if(IsPlayerAttachedObjectSlotUsed(objectplayerid, 0)) RemovePlayerAttachedObject(objectplayerid, 0);
                SetPlayerAttachedObject(objectplayerid,0, 18915, 2, 0.1, 0.03, -0.005, 90.0, 180.0, 90.0);
                format(bilyash1,sizeof(bilyash1),"Администратор %s выдал вам объект [Бандана №1]",sendername);
                 format(bilyash2,sizeof(bilyash2),"[Adm] Вы выдали объект игроку %s [Бандана №1]",giveplayer);
                SendClientMessage(objectplayerid, COLOR_BLUE,bilyash1);
                SendClientMessage(playerid, COLOR_BLUE, bilyash2);
                   return 1;
                   }
                case 5:
                {
                new sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], bilyash1[128],bilyash2[128];
                GetPlayerName(objectplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                if(IsPlayerAttachedObjectSlotUsed(objectplayerid, 0)) RemovePlayerAttachedObject(objectplayerid, 0);
                SetPlayerAttachedObject(objectplayerid,0, 18912, 2, 0.1, 0.03, -0.005, 90.0, 180.0, 90.0);
                format(bilyash1,sizeof(bilyash1),"Администратор %s выдал вам объект [Бандана №2]",sendername);
                 format(bilyash2,sizeof(bilyash2),"[Adm] Вы выдали объект игроку %s [Бандана №2]",giveplayer);
                SendClientMessage(objectplayerid, COLOR_BLUE,bilyash1);
                SendClientMessage(playerid, COLOR_BLUE, bilyash2);
                   return 1;
                   }
                case 6:
                {
                new sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], bilyash1[128],bilyash2[128];
                GetPlayerName(objectplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                if(IsPlayerAttachedObjectSlotUsed(objectplayerid, 0)) RemovePlayerAttachedObject(objectplayerid, 0);
                SetPlayerAttachedObject(objectplayerid,0, 18916, 2, 0.1, 0.03, -0.005, 90.0, 180.0, 90.0);
                format(bilyash1,sizeof(bilyash1),"Администратор %s выдал вам объект [Бандана №3]",sendername);
                 format(bilyash2,sizeof(bilyash2),"[Adm] Вы выдали объект игроку %s [Бандана №3]",giveplayer);
                SendClientMessage(objectplayerid, COLOR_BLUE,bilyash1);
                SendClientMessage(playerid, COLOR_BLUE, bilyash2);
                   return 1;
                   }
                case 7:
                {
                new sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], bilyash1[128],bilyash2[128];
                GetPlayerName(objectplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                if(IsPlayerAttachedObjectSlotUsed(objectplayerid, 0)) RemovePlayerAttachedObject(objectplayerid, 0);
                SetPlayerAttachedObject(objectplayerid,0, 18917, 2, 0.1, 0.03, -0.005, 90.0, 180.0, 90.0);
                format(bilyash1,sizeof(bilyash1),"Администратор %s выдал вам объект [Бандана №4]",sendername);
                 format(bilyash2,sizeof(bilyash2),"[Adm] Вы выдали объект игроку %s [Бандана №4]",giveplayer);
                SendClientMessage(objectplayerid, COLOR_BLUE,bilyash1);
                SendClientMessage(playerid, COLOR_BLUE, bilyash2);
                   return 1;
                   }
                case 8:
                {
                new sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], bilyash1[128],bilyash2[128];
                GetPlayerName(objectplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                   if(IsPlayerAttachedObjectSlotUsed(objectplayerid, 0)) RemovePlayerAttachedObject(objectplayerid, 0);
                SetPlayerAttachedObject(objectplayerid,0, 18918, 2, 0.1, 0.03, -0.005, 90.0, 180.0, 90.0);
                format(bilyash1,sizeof(bilyash1),"Администратор %s выдал вам объект [Бандана №5]",sendername);
                 format(bilyash2,sizeof(bilyash2),"[Adm] Вы выдали объект игроку %s [Бандана №5]",giveplayer);
                SendClientMessage(objectplayerid, COLOR_BLUE,bilyash1);
                SendClientMessage(playerid, COLOR_BLUE, bilyash2);
                   return 1;
                   }
                case 9:
                {
                new sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], bilyash1[128],bilyash2[128];
                GetPlayerName(objectplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                   if(IsPlayerAttachedObjectSlotUsed(objectplayerid, 4)) RemovePlayerAttachedObject(objectplayerid, 4);
                SetPlayerAttachedObject(objectplayerid,4, 3528, 2, 0.111052, 0.021643, -0.000846, 92.280899, 92.752510, 358.071044, 0.100000, 0.100000, 0.100000);
                format(bilyash1,sizeof(bilyash1),"Администратор %s выдал вам объект [Маска Дракона]",sendername);
                 format(bilyash2,sizeof(bilyash2),"[Adm] Вы выдали объект игроку %s [Маска Дракона]",giveplayer);
                SendClientMessage(objectplayerid, COLOR_BLUE,bilyash1);
                SendClientMessage(playerid, COLOR_BLUE, bilyash2);
                   return 1;
                   }
                case 10:
                {
                new sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], bilyash1[128],bilyash2[128];
                GetPlayerName(objectplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                   if(IsPlayerAttachedObjectSlotUsed(objectplayerid, 4)) RemovePlayerAttachedObject(objectplayerid, 4);
                SetPlayerAttachedObject(objectplayerid,4, 18643, 2, 0.111052, 0.021643, -0.000846, 92.280899, 92.752510, 358.071044, 1.200000, 1.283168, 1.200000);
                format(bilyash1,sizeof(bilyash1),"Администратор %s выдал вам объект [Лазер на голову]",sendername);
                 format(bilyash2,sizeof(bilyash2),"[Adm] Вы выдали объект игроку %s [Лазер на голову]",giveplayer);
                SendClientMessage(objectplayerid, COLOR_BLUE,bilyash1);
                SendClientMessage(playerid, COLOR_BLUE, bilyash2);
                   return 1;
                   }
                case 11:
                {
                new sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], bilyash1[128],bilyash2[128];
                GetPlayerName(objectplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                   if(IsPlayerAttachedObjectSlotUsed(objectplayerid, 0) || IsPlayerAttachedObjectSlotUsed(objectplayerid, 1) || IsPlayerAttachedObjectSlotUsed(objectplayerid, 4))
                  {
                RemovePlayerAttachedObject(objectplayerid, 0);
                RemovePlayerAttachedObject(objectplayerid, 1);
                    RemovePlayerAttachedObject(objectplayerid, 4);
                 }
                SetPlayerAttachedObject(objectplayerid,0, 18693, 5, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000);
                SetPlayerAttachedObject(objectplayerid,1, 18693, 6, 1.983503, 1.558882, -0.129482, 86.705787, 308.978118, 268.198822, 1.500000, 1.500000, 1.500000);
                SetPlayerAttachedObject(objectplayerid,4, 18965, 2, 0.111052, 0.021643, -0.000846, 92.280899, 92.752510, 358.071044, 1.200000, 1.283168, 1.200000);
                format(bilyash1,sizeof(bilyash1),"Администратор %s выдал вам объект [Комплект всемогущий]",sendername);
                 format(bilyash2,sizeof(bilyash2),"[Adm] Вы выдали объект игроку %s [Комплект всемогущий]",giveplayer);
                SendClientMessage(objectplayerid, COLOR_BLUE,bilyash1);
                SendClientMessage(playerid, COLOR_BLUE, bilyash2);
                   return 1;
                   }
                case 12:
                {
                new sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], bilyash1[128],bilyash2[128];
                GetPlayerName(objectplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                   if(IsPlayerAttachedObjectSlotUsed(objectplayerid, 7)) RemovePlayerAttachedObject(objectplayerid, 7);
                SetPlayerAttachedObject(objectplayerid,7, 19078, 1, 0.329150, -0.072101, 0.156082, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000);
                format(bilyash1,sizeof(bilyash1),"Администратор %s выдал вам объект [Попугай на плечо]",sendername);
                 format(bilyash2,sizeof(bilyash2),"[Adm] Вы выдали объект игроку %s [Попугай на плечо]",giveplayer);
                SendClientMessage(objectplayerid, COLOR_BLUE,bilyash1);
                SendClientMessage(playerid, COLOR_BLUE, bilyash2);
                   return 1;
                   }
                case 13:
                {
                new sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], bilyash1[128],bilyash2[128];
                GetPlayerName(objectplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                   if(IsPlayerAttachedObjectSlotUsed(objectplayerid, 7)) RemovePlayerAttachedObject(objectplayerid, 7);
                SetPlayerAttachedObject(objectplayerid,7, 354, 1, 0.329150, -0.072101, 0.156082, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000);
                format(bilyash1,sizeof(bilyash1),"Администратор %s выдал вам объект [Яркий свет]",sendername);
                 format(bilyash2,sizeof(bilyash2),"[Adm] Вы выдали объект игроку %s [Яркий свет]",giveplayer);
                SendClientMessage(objectplayerid, COLOR_BLUE,bilyash1);
                SendClientMessage(playerid, COLOR_BLUE, bilyash2);
                   return 1;
                   }
                case 14:
                {
                new sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], bilyash1[128],bilyash2[128];
                GetPlayerName(objectplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                   if(IsPlayerAttachedObjectSlotUsed(objectplayerid, 1)) RemovePlayerAttachedObject(objectplayerid, 1);
                SetPlayerAttachedObject(objectplayerid,1, 356, 6, 0.013610, -0.021393, -0.144862, 2.354303, 354.413848, 0.219168, 3.034477, 3.000000, 3.000000);
                format(bilyash1,sizeof(bilyash1),"Администратор %s выдал вам объект [Большой М4 в руку]",sendername);
                 format(bilyash2,sizeof(bilyash2),"[Adm] Вы выдали объект игроку %s [Большой М4 в руку]",giveplayer);
                SendClientMessage(objectplayerid, COLOR_BLUE,bilyash1);
                SendClientMessage(playerid, COLOR_BLUE, bilyash2);
                   return 1;
                   }
                case 15:
                {
                new sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], bilyash1[128],bilyash2[128];
                GetPlayerName(objectplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                   if(IsPlayerAttachedObjectSlotUsed(objectplayerid, 1)) RemovePlayerAttachedObject(objectplayerid, 1);
                SetPlayerAttachedObject(objectplayerid,1, 19086, 8, -0.049768, -0.014062, -0.108385, 87.458297, 263.478149, 184.123764, 0.622413, 1.041609, 1.012785);
                format(bilyash1,sizeof(bilyash1),"Администратор %s выдал вам объект [Пенис]",sendername);
                 format(bilyash2,sizeof(bilyash2),"[Adm] Вы выдали объект игроку %s [Пенис]",giveplayer);
                SendClientMessage(objectplayerid, COLOR_BLUE,bilyash1);
                SendClientMessage(playerid, COLOR_BLUE, bilyash2);
                   return 1;
                   }
                case 16:
                {
                new sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], bilyash1[128],bilyash2[128];
                GetPlayerName(objectplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                   if(IsPlayerAttachedObjectSlotUsed(objectplayerid, 0)) RemovePlayerAttachedObject(objectplayerid, 0);
                SetPlayerAttachedObject(objectplayerid,0, 19078, 1, -1.097527, -0.348305, -0.008029, 0.000000, 0.000000, 0.000000, 8.073966, 8.073966, 8.073966);
                format(bilyash1,sizeof(bilyash1),"Администратор %s выдал вам объект [Костюм попугая]",sendername);
                 format(bilyash2,sizeof(bilyash2),"[Adm] Вы выдали объект игроку %s [Костюм попугая]",giveplayer);
                SendClientMessage(objectplayerid, COLOR_BLUE,bilyash1);
                SendClientMessage(playerid, COLOR_BLUE, bilyash2);
                   return 1;
                   }
                case 17:
                {
                new sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], bilyash1[128],bilyash2[128];
                GetPlayerName(objectplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                   RemovePlayerAttachedObject(objectplayerid, 0);
                RemovePlayerAttachedObject(objectplayerid, 1);
                RemovePlayerAttachedObject(objectplayerid, 2);
                  RemovePlayerAttachedObject(objectplayerid, 3);
                RemovePlayerAttachedObject(objectplayerid, 4);
                  RemovePlayerAttachedObject(objectplayerid, 5);
                RemovePlayerAttachedObject(objectplayerid, 6);
                RemovePlayerAttachedObject(objectplayerid, 7);
                RemovePlayerAttachedObject(objectplayerid, 8);
                RemovePlayerAttachedObject(objectplayerid, 9);
                  format(bilyash1,sizeof(bilyash1),"Администратор %s удалил все ваши объекты",sendername);
                 format(bilyash2,sizeof(bilyash2),"[Adm] Вы удалили все объекты игроку %s",giveplayer);
                SendClientMessage(objectplayerid, COLOR_BLUE,bilyash1);
                SendClientMessage(playerid, COLOR_BLUE, bilyash2);
                   return 1;
                }
            }
        }
    


В public OnPlayerDisconnect

Code: Select all

    RemovePlayerAttachedObject(playerid, 0);
    RemovePlayerAttachedObject(playerid, 1);
    RemovePlayerAttachedObject(playerid, 2);
    RemovePlayerAttachedObject(playerid, 3);
    RemovePlayerAttachedObject(playerid, 4);
    RemovePlayerAttachedObject(playerid, 5);
    RemovePlayerAttachedObject(playerid, 6);
    RemovePlayerAttachedObject(playerid, 7);
    RemovePlayerAttachedObject(playerid, 8);
    RemovePlayerAttachedObject(playerid, 9); 


Это нужно для того, в случае если игрок отсоедененится от сервера (киком, крэшом, /q...), то после перезахода у него уже не будет объектов, которые ему дал администратор.
i love you mxIni Mysql

! ! !


Return to “Команды”

Who is online

Users browsing this forum: 1 guest