Пример #1
0
void PlayerHandler::CheckForHacks()
{
	for (std::map<int, Player*>::iterator it = players->begin(); it != players->end(); it++)
	{
		if (it->second->getMoney() != GetPlayerMoney(it->first))
		{
			it->second->SendMessage(0xF81414, "Kicked from server: Moneyhacks");
			//SetTimer(1000, false, KickDelayed, (void*)(it->first));
			break;
		}
	}
}
Пример #2
0
PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerDeath(int playerid, int killerid, int reason)
{
  int playercash;
  if(killerid == INVALID_PLAYER_ID) {
    SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
    ResetPlayerMoney(playerid);
  } else {
    SendDeathMessage(killerid,playerid,reason);
    SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
    playercash = GetPlayerMoney(playerid);
    if (playercash > 0)  {
      GivePlayerMoney(killerid, playercash);
      ResetPlayerMoney(playerid);
    }
  }
   return true;
}
Пример #3
0
static void SAMPGDK_CALL MoneyGrubScoreUpdate(int timerid, void *param)
{
  int CashScore;
  char name[MAX_PLAYER_NAME];
  char string[128];
  for(int i=0; i<MAX_PLAYERS; i++)
  {
    if (IsPlayerConnected(i))
    {
      GetPlayerName(i, name, MAX_PLAYER_NAME);
         CashScore = GetPlayerMoney(i);
      SetPlayerScore(i, CashScore);
      if (CashScore > CashScoreOld)
      {
        CashScoreOld = CashScore;
        sprintf(string, "$$$ %s is now in the lead $$$", name);
        SendClientMessageToAll(COLOR_YELLOW, string);
      }
    }
  }
}
Пример #4
0
PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerCommandText(int playerid, const char *cmdtext)
{
  char string[128];
  int playermoney;
  char sendername[MAX_PLAYER_NAME];
  char giveplayer[MAX_PLAYER_NAME];
  char *cmd;
  int giveplayerid, moneys;

  // FIXME: const_cast isn't really a good solution
  cmd = strtok(const_cast<char*>(cmdtext), " ");

  if(strcmp(cmd, "/help") == 0) {
    SendPlayerFormattedText(playerid,"Las Venturas Deathmatch: Money Grub Coded By Jax and the SA-MP Team.",0);
    SendPlayerFormattedText(playerid,"Type: /objective : to find out what to do in this gamemode.",0);
    SendPlayerFormattedText(playerid,"Type: /givecash [playerid] [money-amount] to send money to other players.",0);
    SendPlayerFormattedText(playerid,"Type: /tips : to see some tips from the creator of the gamemode.", 0);
    return true;
  }

  if(strcmp(cmd, "/objective") == 0) {
    SendPlayerFormattedText(playerid,"This gamemode is faily open, there's no specific win / endgame conditions to meet.",0);
    SendPlayerFormattedText(playerid,"In LVDM:Money Grub, when you kill a player, you will receive whatever money they have.",0);
    SendPlayerFormattedText(playerid,"Consequently, if you have lots of money, and you die, your killer gets your cash.",0);
    SendPlayerFormattedText(playerid,"However, you're not forced to kill players for money, you can always gamble in the", 0);
    SendPlayerFormattedText(playerid,"Casino's.", 0);
    return true;
  }
  if(strcmp(cmd, "/tips") == 0) {
    SendPlayerFormattedText(playerid,"Spawning with just a desert eagle might sound lame, however the idea of this",0);
    SendPlayerFormattedText(playerid,"gamemode is to get some cash, get better guns, then go after whoever has the",0);
    SendPlayerFormattedText(playerid,"most cash. Once you've got the most cash, the idea is to stay alive(with the",0);
    SendPlayerFormattedText(playerid,"cash intact)until the game ends, simple right?", 0);
    return true;
  }

   if(strcmp(cmd, "/givecash") == 0) {
    cmd = strtok(NULL, " ");

    if(cmd == 0 || !strlen(cmd)) {
      SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
      return true;
    }
    giveplayerid = atoi(cmd);

    cmd = strtok(NULL, " ");
    if(cmd == 0 || !strlen(cmd)) {
      SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
      return true;
    }
     moneys = atoi(cmd);

    if (IsPlayerConnected(giveplayerid)) {
      GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME);
      GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
      playermoney = GetPlayerMoney(playerid);
      if (moneys > 0 && playermoney >= moneys) {
        GivePlayerMoney(playerid, (0 - moneys));
        GivePlayerMoney(giveplayerid, moneys);
        sprintf(string, "You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        sprintf(string, "You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
        SendClientMessage(giveplayerid, COLOR_YELLOW, string);
        ServerLog::Printf("%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
      }
      else {
        SendClientMessage(playerid, COLOR_YELLOW, "Invalid transaction amount.");
      }
    }
    else {
      sprintf(string, "%d is not an active player.", giveplayerid);
      SendClientMessage(playerid, COLOR_YELLOW, string);
    }
    return true;
  }

  return false;
}