Rob message
#1

How i can do the command when someone rob house and its send auto messega to owner of the house
"ur house robbed"
Код:
if(strcmp(cmd,"/sellrob",true)==0)
 {
  new tmpcar = GetPlayerVehicleID(playerid);
  if(PlayerInfo[playerid][pJob] == 10)
  {
     if(!IsARobTruck(tmpcar)) return SendClientMessage(playerid, COLOR_GREY, " Вы не в грузовике с краденым!");
   if(!IsPlayerInRangeOfPoint(playerid,10,365.29998779,-88.19999695,1.00000000)) return SendClientMessage(playerid, COLOR_GREY, " Вы не на месте сбыта краденого!");
   if(PlayerInfo[playerid][pRob] != 0)
    {
     GivePlayerMoney(playerid,PlayerInfo[playerid][pRob]*50);
     format(string,sizeof(string)," ИНФО: Вы заработали %d$ за украденные вещи",PlayerInfo[playerid][pRob]*50);
     SendClientMessage(playerid,COLOR_WHITE,string);
     SendClientMessage(, COLOR_RED, " Вам сообщили, что ваш дом обокрали!");
     SendClientMessage(o, COLOR_RED, " Затраты на украденные вещи: %d$",PlayerInfo[playerid][pRob]*50);
     DisablePlayerCheckpoint(playerid); PlayerInfo[playerid][pRob] = 0;
     SetPlayerCriminal(playerid,255, " Воровство");
     robhouse2[playerid] = 0;
     robhouse3[playerid] = 0;
     return 1;
    }
   else return SendClientMessage(playerid,COLOR_WHITE," Вы ничего не украли!");
  }
  else
  {
   SendClientMessage(playerid, COLOR_GREY, " ИНФО: Вы не вор!");
  }
  return 1;
 }
Код:
if(strcmp(cmd,"/houserob",true)==0)
 {
  for(new h = 0; h < sizeof(HouseInfo); h++)
     {
   if(PlayerInfo[playerid][pJob] == 10)
   {
       if(PlayerInfo[playerid][pRobSkill] < 45) return SendClientMessage(playerid, COLOR_GREY, " Ваш навык воровства слишком мал, чтобы выносить вещи!");
       if(HouseInfo[h][hOwned] == 0) return SendClientMessage(playerid, COLOR_GREY, " У этого дома нет владельца!");
                if(robhouse3[playerid] ==1) return SendClientMessage(playerid, COLOR_GREY, " Вы уже взяли вещь");
       if(robhouse[playerid] !=0) return SendClientMessage(playerid, COLOR_GREY, " Вы уже грабили дом в этом часу");
       if(IsPlayerInRangeOfPoint(playerid,10,HouseInfo[h][hExitx], HouseInfo[h][hExity], HouseInfo[h][hExitz]))
    {
        switch(random(4))
     {
     case 0:
      {
                         SendClientMessage(playerid, COLOR_GREEN, "Вы украли видеомагнитофон, погрузите награбленное в воровской грузовик: /loadrob");
       SetPlayerAttachedObject(playerid,1,1783,1,0.11,0.36,0.0,0.0,90.0);
       ClearAnimations(playerid);
       ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,1,0,0,1,1,1);
       SetPlayerCheckpoint(playerid,365.29998779,-88.19999695,1.00000000,4.0);
       GetPlayerName(playerid, sendername, sizeof(sendername));
       SendClientMessage(playerid, COLOR_WHITE, "Место сбыта краденого помечено красной меткой");
       robhouse3[playerid] = 1;
       robhouse2[playerid] = 1;
      }
     case 1:
      {
                         SendClientMessage(playerid, COLOR_GREEN, "Вы украли телевизор, погрузите награбленное в воровской грузовик: /loadrob");
       SetPlayerAttachedObject(playerid,1,2648,1,0.11,0.36,0.0,0.0,90.0);
       ClearAnimations(playerid);
       ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,1,0,0,1,1,1);
       SetPlayerCheckpoint(playerid,365.29998779,-88.19999695,1.00000000,4.0);
       GetPlayerName(playerid, sendername, sizeof(sendername));
       SendClientMessage(playerid, COLOR_WHITE, "Место сбыта краденого помечено красной меткой");
       robhouse3[playerid] = 1;
       robhouse2[playerid] = 1;
      }
                    case 2:
      {
             SendClientMessage(playerid, COLOR_GREEN, "Вы украли магнитофон, погрузите награбленное в воровской грузовик: /loadrob");
       SetPlayerAttachedObject(playerid,1,2102,1,0.11,0.36,0.0,0.0,90.0);
       ClearAnimations(playerid);
       ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,1,0,0,1,1,1);
       SetPlayerCheckpoint(playerid,365.29998779,-88.19999695,1.00000000,4.0);
       GetPlayerName(playerid, sendername, sizeof(sendername));
       SendClientMessage(playerid, COLOR_WHITE, "Место сбыта краденого помечено красной меткой");
       robhouse3[playerid] = 1;
       robhouse2[playerid] = 1;
      }
     case 3:
      {
             SendClientMessage(playerid, COLOR_GREEN, "Вы украли игровую приставку, погрузите награбленное в воровской грузовик: /loadrob");
       SetPlayerAttachedObject(playerid,1,2028,1,0.11,0.36,0.0,0.0,90.0);
       ClearAnimations(playerid);
       ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,1,0,0,1,1,1);
       SetPlayerCheckpoint(playerid,365.29998779,-88.19999695,1.00000000,4.0);
       GetPlayerName(playerid, sendername, sizeof(sendername));
       SendClientMessage(playerid, COLOR_WHITE, "Место сбыта краденого помечено красной меткой");
       robhouse3[playerid] = 1;
       robhouse2[playerid] = 1;
      }
     }
     return 1;
    }
   }
   else
   {
    SendClientMessage(playerid, COLOR_GREY, " ИНФО: Вы не вор!");
   }
  }
  return 1;
 }
Код:
SendClientMessage([House owner what i need to put here to send auto message to owner of the house?], COLOR_RED, " Вам сообщили, что ваш дом обокрали!");
Reply
#2

First off, why are you using strcmp, there are better alternatives out there.

Secondly, what is this?..
pawn Код:
SendClientMessage(, COLOR_RED, " Вам сообщили, что ваш дом обокрали!");
     SendClientMessage(o, COLOR_RED, " Затраты на украденные вещи: %d$",PlayerInfo[playerid][pRob]*50);
Who is it being sent to o.o.

Thirdly, I'm not sure if a large portion of that code makes sense to me. o.o, you basically hardcoded a bunch of stuff that could easily be reduced by ~20 lines.

Rather than
pawn Код:
switch (random(4))
{
  case 1:
  {
    robhouse3[playerid] = 1;
    robhouse2[playerid] = 1;
  }
  case 2:
  {
    robhouse3[playerid] = 1;
    robhouse2[playerid] = 1;
  }
  case 3:
  {
    robhouse3[playerid] = 1;
    robhouse2[playerid] = 1;
  }
}
Why don't you use
pawn Код:
switch (random(4))
{
  case 1:
  {

  }
  case 2:
  {

  }
  case 3:
  {

  }
}
robhouse3[playerid] = 1;
robhouse2[playerid] = 1;
That's about all I could find, I don't understand russian and I have a hard time telling what you're even trying to do.
For messaging the houseowner, check who is the owner of the house and if he is online send him a message?..
Reply
#3

Is something like

pawn Код:
//    /houserob

for(new v, b = GetMaxPlayers(); v != b; v++)
    if(PlayerInfo[v][pPhousekey] == h)
    {
        SendClientMessage(v,-1,"House robbed.");
        v = GetMaxPlayers();
    }
Reply
#4

Ok i am trying
Reply
#5

Not work "Unknown command"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)