Question

Ребят, как сделать что бы при команде /arrest помещало клетку рандомно? 8 Мест тюрьме

Спойлер

CMD:arrest(playerid, params[])
{
    if(!IsACop(playerid)) return 1;
    if(!GetPVarInt(playerid,"StartRabWork")) return SCM(playerid,0xFF0000AA,"[Ошибка] {ffffff}Вы не начали рабочий день!");
    if(!PlayerToPoint(6.0,playerid,17.0529,1469.1930,1083.4559) && !PlayerToPoint(6.0, playerid, 218.2263,114.9286,999.0156) && !PlayerToPoint(6.0, playerid, 198.3940,157.9389,1003.0234)) return 1;
    if(sscanf(params, "d",params[0])) return    SendClientMessage(playerid, 0xffffffFF, "• {FFCC00}[Подсказка] {ffffff}/arrest [кол-во минут]");
    if(params[0] < 10 || params[0] > 40) return SendClientMessage(playerid, 0xFF0000AA, "[Ошибка] {ffffff}Количество минут от 10 до 40");
    new suspect = GetClosestPlayer(playerid);
    if(!IsPlayerConnected(suspect)) return SendClientMessage(playerid, 0xFF0000AA, "[Ошибка] {ffffff}Игрок не найден");
    if(!ProxDetectorS(4.0, playerid, suspect)) return SendClientMessage(playerid, 0xFF0000AA, "[Ошибка] {ffffff}Рядом с вами никого нет!");
    if(PlayerInfo[suspect][pWanted] < 1) return  SendClientMessage(playerid, 0xFF0000AA, "[Ошибка] {ffffff}Человек должен иметь хотя бы один уровень розыска!");
    SCMF(suspect,COLOR_BLUE, "Вас посадил в тюрьму %s на %d секунд", PlayerInfo[playerid][pNames],  params[0]*60);
    SCMF(playerid,COLOR_BLUE, "Вы посадили в тюрьму %s на %d секунд", PlayerInfo[suspect][pNames],  params[0]*60);
    PlayerInfo[playerid][pPayCheck] += (PlayerInfo[suspect][pWanted]*200);
    ResetPlayerWeapons(suspect);
    SetPlayerSpecialAction(suspect,SPECIAL_ACTION_NONE);
    TogglePlayerControllable(suspect, 1);
    DeletePVar(suspect, "PlayerCuffed");
    SetPlayerWantedLevel(suspect, 0);
    PlayerInfo[suspect][pJailTime] = params[0]*60;
    PlayerInfo[suspect][pWanted] = 0;
    PlayerInfo[suspect][pZakonp] --;
    if(PlayerToPoint(6.0,playerid,17.0529,1469.1930,1083.4559))
    {
        PlayerInfo[suspect][pMestoJail] = 1;
        SetPlayerInterior(suspect, 6);
        SetPlayerPosEx(suspect,264.1425,77.4712,1001.0391);
        SetPlayerFacingAngle(suspect, 263.0160);
    }
    else if(PlayerToPoint(6.0, playerid, 218.2263,114.9286,999.0156))
    {
        PlayerInfo[suspect][pMestoJail] = 2;
        SetPlayerInterior(playerid, 10);
        SetPlayerPosEx(playerid,219.5400,109.9767,999.0156);
        SetPlayerFacingAngle(playerid, 1.0000);
    }
    else if(PlayerToPoint(6.0, playerid, 198.3940,157.9389,1003.0234))
    {
        PlayerInfo[suspect][pMestoJail] = 3;
        SetPlayerInterior(playerid, 3);
        SetPlayerPosEx(playerid,198.3642,161.8103,1003.0300);
        SetPlayerFacingAngle(playerid, 1.0000);
    }
    PlayerInfo[suspect][pJailed] = 1;
    new string[164];
    mysql_format(connects, string, 164, "UPDATE `accounts` SET `pJailed` = '1', `pJailTime` = '%d', `pWanted` = '0', `pMestoJail` = '%d', `pZakonp` = '%d' WHERE `id` = '%d'", PlayerInfo[suspect][pJailTime], PlayerInfo[suspect][pMestoJail], PlayerInfo[suspect][pZakonp], PlayerInfo[suspect][pID]);
    mysql_empty(connects, string);
    return 1;
}

 

Edited by FENRIS

Заметка от LilPokemon , создано

Нет актива. Тема закрыта.

Share this post


Link to post

4 answers to this question

  • 0

@FENRIS 

		switch(random(8)) {
		case 0: 
		{
			//Рандом 1
		}
		case 1: 
		{
			//Рандом 2
		}
		case 2: 
		{
			//Рандом 3
		}
		case 3: 
		{
			//Рандом 4
		}
		case 4: 
		{
			//Рандом 5
		}
		case 5: 
		{
			//Рандом 6
		}
          case 6: 
		{
			//Рандом 7
		}
		case 8: 
		{
			//Рандом 8
		}

с помощью этой функции

Edited by Jaliba Baron

Share this post


Link to post
  • 0
1 час назад, FENRIS сказал:

Ребят, как сделать что бы при команде /arrest помещало клетку рандомно? 8 Мест тюрьме

  команда (закрыть спойлер)

CMD:arrest(playerid, params[])
{
    if(!IsACop(playerid)) return 1;
    if(!GetPVarInt(playerid,"StartRabWork")) return SCM(playerid,0xFF0000AA,"[Ошибка] {ffffff}Вы не начали рабочий день!");
    if(!PlayerToPoint(6.0,playerid,17.0529,1469.1930,1083.4559) && !PlayerToPoint(6.0, playerid, 218.2263,114.9286,999.0156) && !PlayerToPoint(6.0, playerid, 198.3940,157.9389,1003.0234)) return 1;
    if(sscanf(params, "d",params[0])) return    SendClientMessage(playerid, 0xffffffFF, "• {FFCC00}[Подсказка] {ffffff}/arrest [кол-во минут]");
    if(params[0] < 10 || params[0] > 40) return SendClientMessage(playerid, 0xFF0000AA, "[Ошибка] {ffffff}Количество минут от 10 до 40");
    new suspect = GetClosestPlayer(playerid);
    if(!IsPlayerConnected(suspect)) return SendClientMessage(playerid, 0xFF0000AA, "[Ошибка] {ffffff}Игрок не найден");
    if(!ProxDetectorS(4.0, playerid, suspect)) return SendClientMessage(playerid, 0xFF0000AA, "[Ошибка] {ffffff}Рядом с вами никого нет!");
    if(PlayerInfo[suspect][pWanted] < 1) return  SendClientMessage(playerid, 0xFF0000AA, "[Ошибка] {ffffff}Человек должен иметь хотя бы один уровень розыска!");
    SCMF(suspect,COLOR_BLUE, "Вас посадил в тюрьму %s на %d секунд", PlayerInfo[playerid][pNames],  params[0]*60);
    SCMF(playerid,COLOR_BLUE, "Вы посадили в тюрьму %s на %d секунд", PlayerInfo[suspect][pNames],  params[0]*60);
    PlayerInfo[playerid][pPayCheck] += (PlayerInfo[suspect][pWanted]*200);
    ResetPlayerWeapons(suspect);
    SetPlayerSpecialAction(suspect,SPECIAL_ACTION_NONE);
    TogglePlayerControllable(suspect, 1);
    DeletePVar(suspect, "PlayerCuffed");
    SetPlayerWantedLevel(suspect, 0);
    PlayerInfo[suspect][pJailTime] = params[0]*60;
    PlayerInfo[suspect][pWanted] = 0;
    PlayerInfo[suspect][pZakonp] --;
    if(PlayerToPoint(6.0,playerid,17.0529,1469.1930,1083.4559))
    {
        PlayerInfo[suspect][pMestoJail] = 1;
        SetPlayerInterior(suspect, 6);
        SetPlayerPosEx(suspect,264.1425,77.4712,1001.0391);
        SetPlayerFacingAngle(suspect, 263.0160);
    }
    else if(PlayerToPoint(6.0, playerid, 218.2263,114.9286,999.0156))
    {
        PlayerInfo[suspect][pMestoJail] = 2;
        SetPlayerInterior(playerid, 10);
        SetPlayerPosEx(playerid,219.5400,109.9767,999.0156);
        SetPlayerFacingAngle(playerid, 1.0000);
    }
    else if(PlayerToPoint(6.0, playerid, 198.3940,157.9389,1003.0234))
    {
        PlayerInfo[suspect][pMestoJail] = 3;
        SetPlayerInterior(playerid, 3);
        SetPlayerPosEx(playerid,198.3642,161.8103,1003.0300);
        SetPlayerFacingAngle(playerid, 1.0000);
    }
    PlayerInfo[suspect][pJailed] = 1;
    new string[164];
    mysql_format(connects, string, 164, "UPDATE `accounts` SET `pJailed` = '1', `pJailTime` = '%d', `pWanted` = '0', `pMestoJail` = '%d', `pZakonp` = '%d' WHERE `id` = '%d'", PlayerInfo[suspect][pJailTime], PlayerInfo[suspect][pMestoJail], PlayerInfo[suspect][pZakonp], PlayerInfo[suspect][pID]);
    mysql_empty(connects, string);
    return 1;
}

 

 

По пробуй так!

 

Спойлер

CMD:arrest(playerid, params[])
{
    if(!IsACop(playerid)) return 1;
    if(!GetPVarInt(playerid,"StartRabWork")) return SCM(playerid,0xFF0000AA,"[Ошибка] {ffffff}Вы не начали рабочий день!");
    if(!PlayerToPoint(6.0,playerid,17.0529,1469.1930,1083.4559) && !PlayerToPoint(6.0, playerid, 218.2263,114.9286,999.0156) && !PlayerToPoint(6.0, playerid, 198.3940,157.9389,1003.0234)) return 1;
    if(sscanf(params, "d",params[0])) return    SendClientMessage(playerid, 0xffffffFF, "• {FFCC00}[Подсказка] {ffffff}/arrest [кол-во минут]");
    if(params[0] < 10 || params[0] > 40) return SendClientMessage(playerid, 0xFF0000AA, "[Ошибка] {ffffff}Количество минут от 10 до 40");
    new suspect = GetClosestPlayer(playerid);
    if(!IsPlayerConnected(suspect)) return SendClientMessage(playerid, 0xFF0000AA, "[Ошибка] {ffffff}Игрок не найден");
    if(!ProxDetectorS(4.0, playerid, suspect)) return SendClientMessage(playerid, 0xFF0000AA, "[Ошибка] {ffffff}Рядом с вами никого нет!");
    if(PlayerInfo[suspect][pWanted] < 1) return  SendClientMessage(playerid, 0xFF0000AA, "[Ошибка] {ffffff}Человек должен иметь хотя бы один уровень розыска!");
    SCMF(suspect,COLOR_BLUE, "Вас посадил в тюрьму %s на %d секунд", PlayerInfo[playerid][pNames],  params[0]*60);
    SCMF(playerid,COLOR_BLUE, "Вы посадили в тюрьму %s на %d секунд", PlayerInfo[suspect][pNames],  params[0]*60);
    PlayerInfo[playerid][pPayCheck] += (PlayerInfo[suspect][pWanted]*200);
    ResetPlayerWeapons(suspect);
    SetPlayerSpecialAction(suspect,SPECIAL_ACTION_NONE);
    TogglePlayerControllable(suspect, 1);
    DeletePVar(suspect, "PlayerCuffed");
    SetPlayerWantedLevel(suspect, 0);
    PlayerInfo[suspect][pJailTime] = params[0]*60;
    PlayerInfo[suspect][pWanted] = 0;
    PlayerInfo[suspect][pZakonp] --;
    if(PlayerToPoint(6.0,playerid,17.0529,1469.1930,1083.4559)
    || PlayerToPoint(6.0, playerid, 218.2263,114.9286,999.0156)
    || PlayerToPoint(6.0, playerid, 198.3940,157.9389,1003.0234))
    {
      switch(random(3))
      {
        case 0:
        {
          PlayerInfo[suspect][pMestoJail] = 1;
          SetPlayerInterior(suspect, 6);
          SetPlayerPosEx(suspect,264.1425,77.4712,1001.0391);
          SetPlayerFacingAngle(suspect, 263.0160);
        }
        case 1:
        {
          PlayerInfo[suspect][pMestoJail] = 2;
          SetPlayerInterior(playerid, 10);
          SetPlayerPosEx(playerid,219.5400,109.9767,999.0156);
          SetPlayerFacingAngle(playerid, 1.0000);
       	}
        case 2:
        {
          PlayerInfo[suspect][pMestoJail] = 3;
          SetPlayerInterior(playerid, 3);
          SetPlayerPosEx(playerid,198.3642,161.8103,1003.0300);
          SetPlayerFacingAngle(playerid, 1.0000);
        }
      }
    }
    PlayerInfo[suspect][pJailed] = 1;
    new string[164];
    mysql_format(connects, string, 164, "UPDATE `accounts` SET `pJailed` = '1', `pJailTime` = '%d', `pWanted` = '0', `pMestoJail` = '%d', `pZakonp` = '%d' WHERE `id` = '%d'", PlayerInfo[suspect][pJailTime], PlayerInfo[suspect][pMestoJail], PlayerInfo[suspect][pZakonp], PlayerInfo[suspect][pID]);
    mysql_empty(connects, string);
    return 1;
}

 

 

Edited by Andrey_Akkerman

Share this post


Link to post
  • 0
2 часа назад, Jaliba Baron сказал:

switch(random(3))

рандом только от трех, а элементов 8

Share this post


Link to post
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content