25.05.2014, 18:21
I put myself Event StuntNRG and I have a problem.
Event starts say 10 minutes and. Problem is that it does not start, but I put Settimer.
Help me ?
Event starts say 10 minutes and. Problem is that it does not start, but I put Settimer.
Help me ?
pawn Код:
//NRG
new Float:NRGStuntX;
new Float:NRGStuntY;
new Float:NRGStuntZ;
new NRGStarted;
new IsAtStuntEvent[MAX_PLAYERS];
new Float:NRGStunt[][3] =
{
{1005.3336,-935.8200,47.7870},
{1206.0599,-1791.2509,33.2594},
{2170.7207,2230.1675,24.5135},
{1959.7527,1948.9136,22.7932},
{1419.0551,-1008.9674,46.5068},
{1494.8749,-676.1847,105.7233},
{1829.6609,-1412.6492,29.1925}
};
forward StartNewNRGEvent();
public StartNewNRGEvent()
{
NRGStarted = 1;
new str[128];
new rand = random(sizeof(NRGStunt));
CashboxValue = MinCashboxValue+random(MaxCashboxValue-MinCashboxValue);
CreatePickup(1210, 3, NRGStunt[rand][0], NRGStunt[rand][1], NRGStunt[rand][2],-999);
NRGStuntX = NRGStunt[rand][0];
NRGStuntY = NRGStunt[rand][1];
NRGStuntZ = NRGStunt[rand][2];
format(str, 128, "{D40000}Stunt event {FFFFFF}a inceput,intra la event,ajungi la checkpoint si castigi {FF9900}$%d.", CashboxValue);
SendClientMessageToAll(COLOR_WHITE, str);
SendClientMessageToAll(COLOR_WHITE, "Foloseste {D40000}/stuntevent{FFFFFF} pentru a intra la event!");
SendClientMessageToAll(COLOR_WHITE, "Aveti la dispozitie {FF9900}15 minute{FFFFFF} sa ajungeti la checkpoint.");
//SetTimer("EndNRGEvent", 6000000, 0);
}
forward EndNRGEvent();
public EndNRGEvent()
{
if(NRGStarted == 1)
{
NRGStarted = 0;
new str[128];
format(str, 128, "Nimeni nu a ajuns la checkpoint-ul de la {FF9900}stunt event!", CashboxValue);
SendClientMessageToAll(COLOR_WHITE, str);
SendClientMessageToAll(COLOR_WHITE, "Un nou event va incepe in {FFFFFF}60 minute.");
}
else if(NRGStarted == 0)
{
return 1;
}
return 0;
}
else if(IsAtStuntEvent[playerid] == 1 && NRGStarted == 1)
{
if(IsPlayerInAnyVehicle(playerid))
{
new str[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(str, 128, "{33FF33}%s (ID: %d) {FFFFFF}a ajuns la checkpoint-ul de la {FF9900}stunt event{FFFFFF},acesta a castigat {FF9900}$%d", pName, playerid, CashboxValue);
SendClientMessageToAll(COLOR_WHITE, str);
SendClientMessageToAll(COLOR_WHITE, "Un nou stunt event va incepe in {00E000}10 minute.");
GivePlayerMoney(playerid, CashboxValue);
format(str, 128, "~y~Felicitari! ~n~~r~ Ai castigat ~n~~g~$%d", CashboxValue);
GameTextForPlayer(playerid, str, 4000, 3);
IsAtStuntEvent[playerid] = 0;
DisablePlayerCheckpoint(playerid);
NRGStarted = 0;
SetTimer("StartNRGStunt", 100000, 0);
}
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsAtStuntEvent[i] == 1)
{
DisablePlayerCheckpoint(i);
return 1;
}
}
}
if(strcmp(cmd,"/stuntevent",true)==0)
{
if(IsPlayerConnected(playerid))
{
if(NRGStarted == 0)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE,"This event isn't started at the moment!");
return 1;
}
if(PlayerOnMission[playerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " You're on mission right now,you can't hold any Materials Packages!");
return 1;
}
SetPlayerCheckpoint(playerid, NRGStuntX,NRGStuntY,NRGStuntZ, 3.0);
IsAtStuntEvent[playerid] = 1;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "{FFFFFF}••• Ai intrat la {FF9900}StuntEVENT. {FFFFFF}Du-te la checkpoint si fa {FF9900}stunt-ul!");
return 1;
}
}
if(strcmp(cmd,"/startstuntevent",true)==0)
{
if(IsPlayerConnected(playerid) && PlayerInfo[playerid][pAdmin] >= 1337)
{
StartNewNRGEvent();
return 1;
}
}
if(strcmp(cmd,"/stopstuntevent",true)==0)
{
if(IsPlayerConnected(playerid))
{
IsAtStuntEvent[playerid] = 0;
SendClientMessage(playerid, COLOR_GREY, "Ai oprit {FF9900}StuntEvent-ul!");
return 1;
}
}