Cum as putea adauga un timer ca atunci cand intra in primul checkpoint sa stea 5 secunde si in alea 5 secunde sa ii apara o bara care se incarca ca si aici: http://imageshack.us/a/img850/4199/pluk.png ,iar dupa ce au trecut 5 secunde sa ii apara urmatorul checkpoint.
Question
Pinki95
Cum as putea adauga un timer ca atunci cand intra in primul checkpoint sa stea 5 secunde si in alea 5 secunde sa ii apara o bara care se incarca ca si aici: http://imageshack.us/a/img850/4199/pluk.png ,iar dupa ce au trecut 5 secunde sa ii apara urmatorul checkpoint.
GM:
[pawn]#include <a_samp>
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define COLOR_ORANGE 0xFFA500FF
#define COLOR_LIMEGREEN 0x32CD32FF
#define COLOR_ROYALBLUE 0x4169E1FF
#define COLOR_SALMON 0xFA8072FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_RED 0xAA3333AA
enum BusLocationsEnum
{
ID,
LoadName[128],
Float:LoadX,
Float:LoadY,
Float:LoadZ,
Float:UnloadX,
Float:UnloadY,
Float:UnloadZ,
Pay
}
enum PilotLocationsEnum
{
ID,
LoadName[128],
Float:LoadX,
Float:LoadY,
Float:LoadZ,
Float:UnloadX,
Float:UnloadY,
Float:UnloadZ,
Pay
}
new BusLocations[][busLocationsEnum] =
{
{0, "Beer from Red County Brewery to Bone County Diner",-24.4073,-281.8898,5.9985,-305.4319,1315.6797,54.6189, 5980},
{1, "Fuel from LV Oil Refinery to LV Dirtring",266.8981,1416.5417,10.2001,1097.5164,1741.7422,10.5474, 5700},
{2, "Vehicle Parts from SF Airport ATC to Wang Cars",-1268.8223,13.6925,14.8682,-1986.3477,253.9728,35.8985, 3000},
{3, "Fuel from SF Oil Refinery to RS Haul",-1016.3634,-688.2434,32.7284,-55.3397,-1138.2479,0.8052, 18770}
};
new PilotLocations[][PilotLocationsEnum] =
{
{0, "Beer from Red County Brewery to Bone County Diner",-1268.8223,13.6925,14.8682,-1268.8223,13.6925,14.8682, 5980},
{1, "Fuel from LV Oil Refinery to LV Dirtring",-1268.8223,13.6925,14.8682,-1268.8223,13.6925,14.8682, 5700},
{2, "Vehicle Parts from SF Airport ATC to Wang Cars",-1268.8223,13.6925,14.8682,-1268.8223,13.6925,14.8682, 3000},
{3, "Fuel from SF Oil Refinery to RS Haul",-1268.8223,13.6925,14.8682,-1268.8223,13.6925,14.8682, 18770}
};
#define TEAM_AUTOBUS 1
#define TEAM_PILOT 2
new iMissionText[512][MAX_PLAYERS], Float:unx[MAX_PLAYERS], Float:uny[MAX_PLAYERS], Float:unz[MAX_PLAYERS], iPay[MAX_PLAYERS], MissionStatus[MAX_PLAYERS];
main(){}
public OnGameModeInit()
{
AddPlayerClass(72, -2105.3228, -124.2982, 37.2531, 0.0, 0, 0, 0, 0, 0, 0);//Trucker - SF
AddPlayerClass(98, -1226.5083, 55.1571, 14.1324, 244.1263, 0, 0, 0, 0, 0, 0); // spawn
CreateVehicle(520, -1217.2897, 41.9185, 14.1401, 198.6408, 3, 3, 600);
CreateVehicle(431, -2125.7415, -90.8166, 35.3203, 268.5503, 3, 6, 600); // Tir
CreateVehicle(437, -2125.7297, -102.2942, 35.3203, 267.3752, 3, 3, 600); // Remorca
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
InterpolateCameraPos(playerid,1452.445556,-814.403869,88.533508,1415.500000,-813.963256,90.274688,2222);
InterpolateCameraLookAt(playerid,1449.309692,-817.947631,86.918464,1415.342529,-809.165588,91.673728,2222);
SetPlayerPos(playerid,1415.590576,-808.479675,91.853370);
SetPlayerFacingAngle(playerid,184.728164);
switch (classid)
{
case 0:
{
GameTextForPlayer(playerid, "~b~Bus Driver", 3000, 4);
SetPlayerTeam(playerid, TEAM_AUTOBUS);
}
case 1:
{
GameTextForPlayer(playerid, "~r~Pilot", 3000, 4);
SetPlayerTeam(playerid, TEAM_PILOT);
}
}
return 1;
}
public OnPlayerSpawn(playerid)
{
if(GetPlayerTeam(playerid) == TEAM_AUTOBUS)
{
SetPlayerColor(playerid, COLOR_LIGHTBLUE);
}
if(GetPlayerTeam(playerid) == TEAM_PILOT)
{
SetPlayerColor(playerid, COLOR_YELLOW);
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(work, 4, cmdtext);
dcmd(stopwork, 8, cmdtext);
dcmd(fun, 3, cmdtext);
dcmd(reclass, 7, cmdtext);
return 0;
}
dcmd_work(playerid, params[])
{
#pragma unused params
if(GetPlayerTeam(playerid) == TEAM_AUTOBUS) return T_NewJob(playerid);
if(GetPlayerTeam(playerid) == TEAM_PILOT) return T_NewJobPilot(playerid);
return 1;
}
dcmd_stopwork(playerid, params[])
{
#pragma unused params
if(GetPlayerTeam(playerid) == TEAM_AUTOBUS) return StopWork(playerid);
if(GetPlayerTeam(playerid) == TEAM_PILOT) return StopWork(playerid);
return 1;
}
dcmd_fun(playerid, params[])
{
#pragma unused params
if(IsPlayerAdmin(playerid))
{
GivePlayerWeapon(playerid, 24, 100);
GivePlayerWeapon(playerid, 38, 500);
GivePlayerWeapon(playerid, 30, 900);
GivePlayerWeapon(playerid, 28, 800);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
}
return 1;
}
dcmd_reclass(playerid, params[])
{
#pragma unused params
ForceClassSelection(playerid);
SetPlayerHealth(playerid, 0.0);
return 1;
}
stock T_NewJob(playerid)
{
new vID = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vID)== 431 || GetVehicleModel(vID)== 437)
{
MissionStatus[playerid] = 1;
new BusRand = random(sizeof(BusLocations));
new LoadText[128], Float:x, Float:y, Float:z;
x = BusLocations[busRand][LoadX];
y = BusLocations[busRand][LoadY];
z = BusLocations[busRand][LoadZ];
unx[playerid] = BusLocations[busRand][unloadX];
uny[playerid] = BusLocations[busRand][unloadY];
unz[playerid] = BusLocations[busRand][unloadZ];
iPay[playerid] = BusLocations[busRand][Pay];
SetPlayerCheckpoint(playerid, x, y, z, 7);
format(LoadText, 128, "%s",BusLocations[busRand][LoadName]);
SendClientMessage(playerid, COLOR_GREEN, "Misiune:");
SendClientMessage(playerid, COLOR_GREEN, "_______________________________");
SendClientMessage(playerid, COLOR_GREEN, "");
SendClientMessage(playerid, 0xFFFFFFFF, LoadText);
SendClientMessage(playerid, COLOR_GREEN, "_______________________________");
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: Trebuie sa fii intr-un autobus!");
}
return 1;
}
stock T_NewJobPilot(playerid)
{
new vID = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vID)== 520)
{
MissionStatus[playerid] = 1;
new PilotRand = random(sizeof(PilotLocations));
new LoadText[128], Float:x, Float:y, Float:z;
x = PilotLocations[PilotRand][LoadX];
y = PilotLocations[PilotRand][LoadY];
z = PilotLocations[PilotRand][LoadZ];
unx[playerid] = PilotLocations[PilotRand][unloadX];
uny[playerid] = PilotLocations[PilotRand][unloadY];
unz[playerid] = PilotLocations[PilotRand][unloadZ];
iPay[playerid] = PilotLocations[PilotRand][Pay];
SetPlayerCheckpoint(playerid, x, y, z, 7);
format(LoadText, 128, "%s",PilotLocations[PilotRand][LoadName]);
SendClientMessage(playerid, COLOR_GREEN, "Misiune:");
SendClientMessage(playerid, COLOR_GREEN, "_______________________________");
SendClientMessage(playerid, COLOR_GREEN, "");
SendClientMessage(playerid, 0xFFFFFFFF, LoadText);
SendClientMessage(playerid, COLOR_GREEN, "_______________________________");
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: Trebuie sa fii intr-un Avion!");
}
return 1;
}
stock StopWork(playerid)
{
DisablePlayerCheckpoint(playerid);
SendClientMessage(playerid, COLOR_RED, "Ai renuntat la misiune si ai pierdut $1000");
GivePlayerMoney(playerid, -1000);
MissionStatus[playerid] = 0;
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
CheckpointEntered(playerid);
return 1;
}
stock CheckpointEntered(playerid)
{
new gString[128];
if(MissionStatus[playerid] == 1)
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, unx[playerid], uny[playerid], unz[playerid], 7);
SendClientMessage(playerid, COLOR_ORANGE, "Du-te la Checkpoint-ul rosu pentru a descarca!");
MissionStatus[playerid] = 2;
}
else if(MissionStatus[playerid] == 2)
{
DisablePlayerCheckpoint(playerid);
GivePlayerMoney(playerid, iPay[playerid]);
SendClientMessage(playerid, COLOR_GREEN, "Bravo! Ai terminat misiunea!");
format(gString, 512, "%s has completed mission: %s", pName(playerid), iMissionText[playerid]);
SendClientMessageToAll(COLOR_GREEN, gString);
SetPlayerScore(playerid, GetPlayerScore(playerid)+2);
MissionStatus[playerid] = 0;
}
return 1;
}
stock pName(PN)
{
new PX[MAX_PLAYER_NAME];
GetPlayerName(PN, PX, sizeof(PX));
return PX;
}[/pawn]
0 answers to this question
Recommended Posts