Untitled

 avatar
user_0390871
plain_text
a year ago
4.4 kB
3
Indexable
Never
stock robhouse_OnPlayerKeypadInput(playerid, keypadID, type, key)
{
	new string[128];
	if(keypadID == 3 && type == KEYPAD_INPUT_GOOD)
	{
		for(new i = 0; i < sizeof(HouseInfo); i++)
		{
			if (IsPlayerInRangeOfPoint(playerid,3,HouseInfo[i][hExteriorX], HouseInfo[i][hExteriorY], HouseInfo[i][hExteriorZ]))
			{
			    new wantedlevel = PlayerInfo[playerid][pWantedLevel];
				format(string, sizeof(string), "* %s Da Be Khoa House Thanh Cong.", GetPlayerNameEx(playerid));
				ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				SetPlayerInterior(playerid,HouseInfo[i][hIntIW]);
				SetPlayerPos(playerid,HouseInfo[i][hInteriorX],HouseInfo[i][hInteriorY],HouseInfo[i][hInteriorZ]);
				GameTextForPlayer(playerid, "~r~Da Be Khoa Thanh Cong", 5000, 1);
				SendClientMessageEx(playerid,COLOR_YELLOW,"Ban da be khoa ngoi nha thanh cong, hay nhanh chong [/cuoptien] !");
				DeletePVar(playerid, "MASOCUANHA");
				DeletePVar(playerid, "fisrttime");
				PlayerInfo[playerid][pInt] = HouseInfo[i][hIntIW];
				PlayerInfo[playerid][pVW] = HouseInfo[i][hIntVW];
				SetPlayerVirtualWorld(playerid,HouseInfo[i][hIntVW]);
				UnLock[playerid]=true;
                RobHouseID[playerid] = i;
				wantedlevel = 2;
				SetPlayerWantedLevel(playerid, wantedlevel);
				format(string, sizeof(string), "UPDATE `accounts` SET `WantedLevel` = %d WHERE `id` = %d", PlayerInfo[playerid][pWantedLevel], GetPlayerSQLId(playerid));
				mysql_tquery(MainPipeline, string, "OnQueryFinish", "ii", SENDDATA_THREAD, playerid);
				if(HouseInfo[i][hCustomInterior] == 1) Player_StreamPrep(playerid, HouseInfo[i][hInteriorX],HouseInfo[i][hInteriorY],HouseInfo[i][hInteriorZ], FREEZE_TIME);
			}
		}
	}
    else if(keypadID == 3 && type == KEYPAD_INPUT_BAD)
    {
        if(key > GetPVarInt(playerid, "MASOCUANHA"))
        	GameTextForPlayer(playerid, "~R~Ma so be hon", 3000, 3);
        else
        	GameTextForPlayer(playerid, "~R~Ma so lon hon", 3000, 3);
    }	
	return 1;
}

CMD:cuoptien(playerid, params[])
{
	if(UnLock[playerid]==true)
	{
		new str[128], string[128], robhcost = Random(50000, 100000);
	    UnLock[playerid] = false;
	    PlayerInfo[playerid][pCash] += robhcost;
		format(string,128,"Ban da cuop thanh cong so tien %s",number_format(robhcost));
	    SendClientMessageEx(playerid, -1, string);
		//
		RobHouseID[playerid]=-1;
		PlayerInfo[playerid][pCuopNha]=1;
		format(str,128,"[SanNews] Thong bao :%s da cuop di mot so tien cua nha %s",GetPlayerNameExt(playerid),HouseInfo[RobHouseID[playerid]][hOwnerName]);
		SendClientMessageToAll(COLOR_RED,str);
	}
	else SendClientMessageEx(playerid, -1, "Ban dang khong thuc hien vu cuop !");
	return 1;
}
CMD:cuopnha(playerid, params[])
{
    if(PlayerInfo[playerid][pLevel] < 3) return SendClientMessageEx(playerid, -1, "Ban phai dat level 3 moi co the thuc hien cuop nha !");
    if(PlayerInfo[playerid][pMember]!=INVALID_GROUP_ID) return SendClientMessageEx(playerid, -1, "Ban dang trong 1 to chuc, khong the cuop nha!");
    if(PlayerInfo[playerid][pCuopNha]==1) return SendClientMessageEx(playerid, -1, "Ban phai doi 1h nua moi co the cuop nha!");
	for(new h = 0; h < sizeof(HouseInfo); h++)
	{
	    if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[h][hExteriorX], HouseInfo[h][hExteriorY], HouseInfo[h][hExteriorZ]) && GetPlayerInterior(playerid) == HouseInfo[h][hExtIW] && GetPlayerVirtualWorld(playerid) == HouseInfo[h][hExtVW])
	    {
		    new MASOCUANHA;
		    MASOCUANHA = Random(100, 999);
			new szKey[6];
			new result;
		    if (GetPVarInt(playerid, "firsttime") != 0)
			{
				MASOCUANHA = GetPVarInt(playerid, "MASOCUANHA");
				valstr(szKey, MASOCUANHA);
				result = ShowPlayerKeypad(playerid, 3, szKey);
				SetPVarInt(playerid, "MASOCUANHA", MASOCUANHA);
		 	}
		    else
			{
				valstr(szKey, MASOCUANHA);
				result = ShowPlayerKeypad(playerid, 3, szKey);
				SetPVarInt(playerid, "MASOCUANHA", MASOCUANHA);
				SetPVarInt(playerid, "firsttime", 1);
		 	}
			if(result == CREATEKEYPAD_RETURN_INVALID_ID) return SendClientMessage(playerid, COLOR_RED, "Invalid keypad ID passed to CreateKeypad()");
			if(result == CREATEKEYPAD_RETURN_NUM) return SendClientMessage(playerid, COLOR_RED, "Invalid keypad string (non-numerical) passed to CreateKeypad()");
		}
	}
	return 1;
}