Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
6.0 kB
2
Indexable
Never
	if(GetPVarInt(playerid, "GarbageJob") > 0)
	{
		if(!IsPlayerInRangeOfPoint(playerid, 5.0, 2596.0659,-2425.5081,13.4688)) {
			new vehicleid = GetPlayerVehicleID(playerid);
			if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT || !IsAGarbageCar(vehicleid))
				return SendClientMessage(playerid, -1, "Ban khong ngoi tren xe van chuyen hang.");
			if(!IsPlayerInRangeOfPoint(playerid, 10.0, GetPVarFloat(playerid, "gbPosX"), GetPVarFloat(playerid, "gbPosY"), GetPVarFloat(playerid, "gbPosZ")))
				return SendClientMessage(playerid, -1, "Ban dang gian lan.");
			
			if (currentCheckpoint >= 10){
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "Quay tro lai ben cang de nhan tien\n\nVi tri duoc danh dau tren ban do (mini map)");
				SetPlayerCheckpoint(playerid, 2596.0659,-2425.5081,13.4688, 5);
				gPlayerCheckpointStatus[playerid] = CHECKPOINT_RETURNGARBAGE;
				DeletePVar(playerid, "GarbageJob");
			}
			else{
				new string[8];
	            currentCheckpoint++;
				PlayerInfo[playerid][pCash] += 3000;
				//
				format(string, sizeof(string), "+$3000");
				GameTextForPlayer(playerid, string, 2200, 3);
	            SetPlayerCheckpoint(playerid, GarbageDropoffs[currentCheckpoint][PosX], GarbageDropoffs[currentCheckpoint][PosY], GarbageDropoffs[currentCheckpoint][PosZ], 5);
	            SetPVarFloat(playerid, "gbPosX", GarbageDropoffs[currentCheckpoint][PosX]);
	            SetPVarFloat(playerid, "gbPosY", GarbageDropoffs[currentCheckpoint][PosY]);
	            SetPVarFloat(playerid, "gbPosZ", GarbageDropoffs[currentCheckpoint][PosZ]);
			}

			new string[128];
			SetPVarInt(playerid, "tpGarbageTimer", 60);//
			SetTimerEx("AntiTeleportTimer", 2000, false, "ii", playerid, TYPE_TPGARBAGETIMER);			
			if(GetPVarInt(playerid, "tpGarbageTimer") != 0)
			{
				format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) co the dang hack teleport.", GetPlayerNameEx(playerid), playerid);
				ABroadCast( COLOR_YELLOW, string, 2 );
				Log("logs/hack.log", string);
			}
		}
		else {
			TogglePlayerControllable(playerid, 0);

			SendClientMessageEx(playerid, -1, "Ban da bat dau do rac.");

			SetPVarInt(playerid, "DoRacTime", 10);
			SetTimerEx("DoRacNe", 1000, 0, "d", playerid);
		}
	}


forward DoRacNe(playerid);
public DoRacNe(playerid)
{
    SetPVarInt(playerid, "DoRacTime", GetPVarInt(playerid, "DoRacTime")-1);

    new string[1280];
    new zone[MAX_ZONE_NAME];
    format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~%d giay con lai", GetPVarInt(playerid, "DoRacTime"));
    GameTextForPlayer(playerid, string, 1100, 3);
    if(GetPVarInt(playerid, "DoRacTime") > 0) SetTimerEx("DoRacNe", 1000, 0, "d", playerid);
    if(GetPVarInt(playerid, "DoRacTime") <= 0)
    {
        DeletePVar(playerid, "DoRacTime");
        DeletePVar(playerid, "DoRacNe");
        
        SendClientMessageEx(playerid, -1, "Ban da do rac thanh cong");
        SetVehicleToRespawn(GetPlayerVehicleID(playerid));

		TogglePlayerControllable(playerid, 1);
		return 1;
    }
	return 1;
}

forward LoadGarbage(playerid);
public LoadGarbage(playerid)
{
	SendClientMessageEx(playerid, -1, "\n{FFFFFF}Ban da nhan duoc vi tri can don dep rac thai(rada map)");
	SendClientMessageEx(playerid, -1, "Moi noi duoc don sach ban se duoc tra $3,000 SAD. Lam viec vui ve !");
	TogglePlayerControllable(playerid, 1);
	DeletePVar(playerid, "IsFrozen");
	SetPVarInt(playerid, "GarbageJob", 1);
	SetPlayerCheckpoint(playerid, GarbageDropoffs[currentCheckpoint][PosX], GarbageDropoffs[currentCheckpoint][PosY], GarbageDropoffs[currentCheckpoint][PosZ], 5);
	SetPVarFloat(playerid, "gbPosX", GarbageDropoffs[currentCheckpoint][PosX]);
	SetPVarFloat(playerid, "gbPosY", GarbageDropoffs[currentCheckpoint][PosY]);
	SetPVarFloat(playerid, "gbPosZ", GarbageDropoffs[currentCheckpoint][PosZ]);
	GameTextForPlayer(playerid, "~r~Checkpoint Set", 1000, 1);
	//Anti Teleport Garbage
	SetPVarInt(playerid, "tpGarbageTimer", 30);
	SetTimerEx("AntiTeleportTimer", 2000, false, "ii", playerid, TYPE_TPGARBAGETIMER);	
}

CMD:donrac(playerid) return cmd_loadgarbage(playerid);
CMD:loadgarbage(playerid)
{
	if(PlayerInfo[playerid][pJob] == 3 || PlayerInfo[playerid][pJob2] == 3)
	{
	    new vehicleid = GetPlayerVehicleID(playerid);
		if(!Lock_Job)
			SendClientMessage(playerid, COLOR_GREY, "Tat ca cong viec deu duoc dong vao luc 00:00 va mo lai vao luc 7:00 sang hom sau");
	    if(IsAGarbageCar(vehicleid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	    {
	        if(!CheckPointCheck(playerid))
	        {
	            if(GetPVarInt(playerid, "LoadGarbageTime") > 0)
	            {
	                SendClientMessageEx(playerid, COLOR_WHITE, "Cong ty dang tinh toan thong tin va chuan bi giao cho ban vi tri!");
					return 1;
	            }
				if(IsPlayerInRangeOfPoint(playerid, 10, 2683.6528,-2411.1392,13.4547))
				{
					SetPVarInt(playerid, "LoadGarbageTime", 1);
					PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
					DisablePlayerCheckpoint(playerid);
					gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
					TogglePlayerControllable(playerid, 0);
					SetPVarInt(playerid, "IsFrozen", 1);
					SetTimerEx("LoadGarbage", 10000, 0, "d", playerid);
					GameTextForPlayer(playerid, "Loading...", 10000, 5);
				}
				else return ShowPlayerDialog(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Cong viec - Don rac", "Ban khong dung o khu don rac", "OK", "");

	        }
	        else ShowPlayerDialog(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Cong viec - Don rac", "ERROR: /xoamuctieu hoac /xmt de thiet lap lai cac checkpoint", "OK", "");
	    }
	    else return ShowPlayerDialog(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Cong viec - Don rac", "Ban phai su dung mot chiec xe rac", "OK", "");
	}
	else return ShowPlayerDialog(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Cong viec - Don rac", "Ban khong phai cong nhan don rac (Garbage Collector)", "OK", "");
	return 1;
}