[Code] Code móc túi

Bạn muốn tắt quảng cáo ?

You want to turn off ads.

Code này mình đã thêm điều kiện không móc túi được bản thân r nhé.
Dưới đây là demo cho các bạn hình dung

DEMO:


CODE:

CMD:moctui(playerid, params[])
{
    new string[128];
    if(GetPVarInt(playerid, "IsInArena") >= 0) {
        SendClientMessageEx(playerid,COLOR_GREY,"   Ban khong the lam dieu nay khi dang o dau truong!");
        return 1;
    }
    if(GetPVarInt( playerid, "EventToken") != 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "Ban khong the lam dieu nay khi dang trong event.");
return 1;
}
    if(WatchingTV[playerid] != 0) {
        SendClientMessageEx(playerid, COLOR_GREY, "Ban khong the lam dieu nay khi dang xem TV!");
        return 1;
    }
    if (PlayerInfo[playerid][pJailTime] > 0) {
        SendClientMessageEx(playerid,COLOR_GREY,"   Khong the moc tui khi dang o tu!");
        return 1;
    }
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "Ban khong the lam dieu nay bay gio.");
    if(PlayerInfo[playerid][pHospital] == 1 || PlayerInfo[playerid][pHospital] == 2 || PlayerInfo[playerid][pHospital] == 3 || PlayerInfo[playerid][pHospital] == 4 || PlayerInfo[playerid][pHospital] == 5) {
        SendClientMessageEx(playerid, COLOR_GREY, "Ban khong the che sung khi dang o Benh vien.");
        return 1;
    }
    if(playerid == giveplayerid)
{
  SendClientMessageEx(playerid, COLOR_GREY, "Ban khong the su dung lenh nay voi chinh minh");
  return 1;
  }
if(PlayerInfo[playerid][pSexTime] > 1)
{
    SendClientMessage(playerid, COLOR_GREY, "Moi lan moc tui phai cach nhau 2 phut!!");
return 1;
    }
    new giveplayerid,x_moctui[20];
    if(sscanf(params, "us[20]", giveplayerid, x_moctui)) {
        SendClientMessageEx(playerid, COLOR_GREEN, "______________MOC TUI____________________");
        SendClientMessageEx(playerid, COLOR_GREY, "Su dung: /moctui [player] [tenvatpham]");
        SendClientMessageEx(playerid, COLOR_GREY, "Ten vat pham : Tien, Vatlieu, Pot, Crack ");
        return 1;
    }
    new ball = random(2);
if(!IsPlayerConnected(giveplayerid)) {
return SendClientMessageEx(playerid, COLOR_GRAD2, "Nguoi choi duoc chon khong hop le.");
}
if(IsPlayerInAnyVehicle(giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "Ban khong the moc tui nguoi do bay gio.");
if(GetPVarInt(giveplayerid, "Injured") == 1) {
    return SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong the moc tui nguoi dang bi thuong.");
}
    if (ProxDetectorS(2.0, playerid, giveplayerid)) {
    if(strcmp(x_moctui,"tien",true) == 0)
    {
    if(ball == 1)
{
           if(PlayerInfo[giveplayerid][pCash] < 1000000)
           {
         SendClientMessageEx(playerid, COLOR_GRAD2, "Nguoi choi do khong con tien.");
         return 1;
           }
  new sotienmoc;
          sotienmoc = random(1000000);
          GivePlayerCash(playerid, sotienmoc);
          GivePlayerCash(giveplayerid, -sotienmoc);
          PlayerInfo[playerid][pSexTime] = 120;
      format(string, sizeof(string), "* %s da moc tui cua %s va lay duoc mot so tien.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
          ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  format(string, sizeof(string), "* Ban da moc tui va lay duoc %d .",sotienmoc);
          SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  format(string, sizeof(string), "* Ban da bi mat %d khi bi moc tui.",sotienmoc);
          SendClientMessageEx(giveplayerid, COLOR_GREY, string);
        }
        else
      {
      format(string, sizeof(string), "* %s da bi %s dam' vao` mat vi bi phat hien hanh vi moc tui.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
          ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  format(string, sizeof(string), "* Ban da moc tui va that bai! Ban bi dam' vao` mom` va` mat' 10 mau' .");
          SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  format(string, sizeof(string), "* Ban da danh ke trom phun mau' mui~ !");
          SendClientMessageEx(giveplayerid, COLOR_GREY, string);
      new Float:health;
      GetPlayerHealth(playerid, health);
      SetPlayerHealth(playerid, health-10);
      }
   }
   else if(strcmp(x_moctui,"vatlieu",true) == 0)
   {
       if(ball == 1)
   {
           if(PlayerInfo[giveplayerid][pMats] < 3000)
           {
         SendClientMessageEx(playerid, COLOR_GRAD2, "Nguoi choi do khong con vat lieu.");
         return 1;
           }
  new vatlieu;
          vatlieu = random(3000);
          PlayerInfo[playerid][pMats] += vatlieu;
          PlayerInfo[giveplayerid][pMats] -= vatlieu;
  PlayerInfo[playerid][pSexTime] = 120;
  format(string, sizeof(string), "* %s da moc tui cua %s va lay duoc mot so vat lieu.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
          ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  format(string, sizeof(string), "* Ban da moc tui va lay duoc %d vat lieu .",vatlieu);
          SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  format(string, sizeof(string), "* Ban da mat %d vat lieu vi bi nguoi khac moc tui.",vatlieu);
          SendClientMessageEx(giveplayerid, COLOR_GREY, string);
       }
       else
   {
      format(string, sizeof(string), "* %s da bi %s dam' vao` mat vi bi phat hien hanh vi moc tui.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
          ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  format(string, sizeof(string), "* Ban da moc tui va that bai! Ban bi dam' vao` mom` va` mat' 10 mau' .");
          SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  format(string, sizeof(string), "* Ban da danh ke trom phun mau' mui~ !");
          SendClientMessageEx(giveplayerid, COLOR_GREY, string);
          SetPlayerHealth(playerid, -10);
      new Float:health;
      GetPlayerHealth(playerid, health);
      SetPlayerHealth(playerid, health-10);
      }
    }
   else if(strcmp(x_moctui,"crack",true) == 0)
   {
       if(ball == 1)
   {
           if(PlayerInfo[giveplayerid][pCrack] < 300)
           {
         SendClientMessageEx(playerid, COLOR_GRAD2, "Nguoi choi do khong con vat lieu.");
         return 1;
           }
  new crack;
          crack = random(300);
          PlayerInfo[playerid][pCrack] += crack;
          PlayerInfo[giveplayerid][pCrack] -= crack;
  PlayerInfo[playerid][pSexTime] = 120;
  format(string, sizeof(string), "* %s da moc tui cua %s va lay duoc mot so vat lieu.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
          ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  format(string, sizeof(string), "* Ban da moc tui va lay duoc %d vat lieu .",crack);
          SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  format(string, sizeof(string), "* Ban da mat %d vat lieu vi bi nguoi khac moc tui.",crack);
          SendClientMessageEx(giveplayerid, COLOR_GREY, string);
       }
       else
   {
      format(string, sizeof(string), "* %s da bi %s dam' vao` mat vi bi phat hien hanh vi moc tui.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
          ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  format(string, sizeof(string), "* Ban da moc tui va that bai! Ban bi dam' vao` mom` va` mat' 10 mau' .");
          SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  format(string, sizeof(string), "* Ban da danh ke trom phun mau' mui~ !");
          SendClientMessageEx(giveplayerid, COLOR_GREY, string);
          SetPlayerHealth(playerid, -10);
      new Float:health;
      GetPlayerHealth(playerid, health);
      SetPlayerHealth(playerid, health-10);
      }
   }
   else if(strcmp(x_moctui,"pot",true) == 0)
   {
       if(ball == 1)
   {
           if(PlayerInfo[giveplayerid][pPot] < 300)
           {
         SendClientMessageEx(playerid, COLOR_GRAD2, "Nguoi choi do khong con vat lieu.");
         return 1;
           }
  new pot;
          pot = random(300);
          PlayerInfo[playerid][pPot] += pot;
          PlayerInfo[giveplayerid][pPot] -= pot;
  PlayerInfo[playerid][pSexTime] = 120;
  format(string, sizeof(string), "* %s da moc tui cua %s va lay duoc mot so vat lieu.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
          ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  format(string, sizeof(string), "* Ban da moc tui va lay duoc %d vat lieu .",pot);
          SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  format(string, sizeof(string), "* Ban da mat %d vat lieu vi bi nguoi khac moc tui.",pot);
          SendClientMessageEx(giveplayerid, COLOR_GREY, string);
       }
       else
   {
      format(string, sizeof(string), "* %s da bi %s dam' vao` mat vi bi phat hien hanh vi moc tui.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
          ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  format(string, sizeof(string), "* Ban da moc tui va that bai! Ban bi dam' vao` mom` va` mat' 10 mau' .");
          SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  format(string, sizeof(string), "* Ban da danh ke trom phun mau' mui~ !");
          SendClientMessageEx(giveplayerid, COLOR_GREY, string);
          SetPlayerHealth(playerid, -10);
      new Float:health;
      GetPlayerHealth(playerid, health);
      SetPlayerHealth(playerid, health-10);
      }
    }
    else
    {
SendClientMessageEx(playerid,COLOR_GREY,"   Ten vat pham khong hop le!");
    return 1;
}
    }
    else
{
        SendClientMessageEx(playerid, COLOR_GREY, "Anh ta khong gan ban.");
        return 1;
    }
return 1;
}

Nguồn: Forum.sa-mp.cick

Tác giả: Phú Cường Blogger

Tôi là Cường, sinh viên năm cuối ngành Điện tử - Viễn thông trường Đại học Bách Khoa Hà Nội. Say hello to you!

  • 7 nhận xét:

    1. add vao cho nao cua gamemode the ạ

      Trả lờiXóa
    2. ./includes/ngg.pwn(126150) : error 021: symbol already defined: "cmd_moctui"
      ./includes/ngg.pwn(126174) : error 017: undefined symbol "giveplayerid"
      Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


      2 Errors.

      Trả lờiXóa
    3. ./includes/variables.pwn(2463) : error 017: undefined symbol "giveplayerid"
      ./includes/variables.pwn(2466) : warning 217: loose indentation
      ./includes/variables.pwn(2468) : warning 217: loose indentation
      ./includes/variables.pwn(2471) : warning 217: loose indentation
      ./includes/variables.pwn(2473) : warning 217: loose indentation
      ./includes/variables.pwn(2481) : warning 217: loose indentation
      ./includes/variables.pwn(2488) : warning 217: loose indentation
      ./includes/variables.pwn(2498) : warning 217: loose indentation
      ./includes/variables.pwn(2499) : warning 217: loose indentation
      ./includes/variables.pwn(2503) : warning 217: loose indentation
      ./includes/variables.pwn(2504) : warning 217: loose indentation
      ./includes/variables.pwn(2505) : warning 217: loose indentation
      ./includes/variables.pwn(2506) : warning 217: loose indentation
      ./includes/variables.pwn(2507) : warning 217: loose indentation
      ./includes/variables.pwn(2508) : warning 217: loose indentation
      ./includes/variables.pwn(2513) : warning 217: loose indentation
      ./includes/variables.pwn(2514) : warning 217: loose indentation
      ./includes/variables.pwn(2515) : warning 217: loose indentation
      ./includes/variables.pwn(2516) : warning 217: loose indentation
      ./includes/variables.pwn(2517) : warning 217: loose indentation
      ./includes/variables.pwn(2518) : warning 217: loose indentation
      ./includes/variables.pwn(2523) : warning 217: loose indentation
      ./includes/variables.pwn(2532) : warning 217: loose indentation
      ./includes/variables.pwn(2533) : warning 217: loose indentation
      ./includes/variables.pwn(2536) : warning 217: loose indentation
      ./includes/variables.pwn(2538) : warning 217: loose indentation
      ./includes/variables.pwn(2539) : warning 217: loose indentation
      ./includes/variables.pwn(2540) : warning 217: loose indentation
      ./includes/variables.pwn(2541) : warning 217: loose indentation
      ./includes/variables.pwn(2542) : warning 217: loose indentation
      ./includes/variables.pwn(2547) : warning 217: loose indentation
      ./includes/variables.pwn(2548) : warning 217: loose indentation
      ./includes/variables.pwn(2549) : warning 217: loose indentation
      ./includes/variables.pwn(2550) : warning 217: loose indentation
      ./includes/variables.pwn(2551) : warning 217: loose indentation
      ./includes/variables.pwn(2553) : warning 217: loose indentation
      ./includes/variables.pwn(2567) : warning 217: loose indentation
      ./includes/variables.pwn(2568) : warning 217: loose indentation
      ./includes/variables.pwn(2571) : warning 217: loose indentation
      ./includes/variables.pwn(2573) : warning 217: loose indentation
      ./includes/variables.pwn(2574) : warning 217: loose indentation
      ./includes/variables.pwn(2575) : warning 217: loose indentation
      ./includes/variables.pwn(2576) : warning 217: loose indentation
      ./includes/variables.pwn(2577) : warning 217: loose indentation
      ./includes/variables.pwn(2582) : warning 217: loose indentation
      ./includes/variables.pwn(2583) : warning 217: loose indentation
      ./includes/variables.pwn(2584) : warning 217: loose indentation
      ./includes/variables.pwn(2585) : warning 217: loose indentation
      ./includes/variables.pwn(2586) : warning 217: loose indentation
      ./includes/variables.pwn(2588) : warning 217: loose indentation
      ./includes/variables.pwn(2602) : warning 217: loose indentation
      ./includes/variables.pwn(2603) : warning 217: loose indentation
      ./includes/variables.pwn(2606) : warning 217: loose indentation
      ./includes/variables.pwn(2608) : warning 217: loose indentation
      ./includes/variables.pwn(2609) : warning 217: loose indentation
      ./includes/variables.pwn(2610) : warning 217: loose indentation
      ./includes/variables.pwn(2611) : warning 217: loose indentation
      ./includes/variables.pwn(2612) : warning 217: loose indentation
      ./includes/variables.pwn(2617) : warning 217: loose indentation
      ./includes/variables.pwn(2618) : warning 217: loose indentation
      ./includes/variables.pwn(2619

      ??

      Trả lờiXóa