Citat: Marley98 poslato Januar 19, 2019, 23:16:32 POSLE PODNE
Kada izadjem iz vozila jednokratnog da se on respavna za 5 do 10 sec
napraviš provjeru kod public OnPlayerExitVehicle
ako je vehicleid od tog vozila sto zelis bracala
npr
[pawn]new nesto = random(6);
switch(nesto)
{
case 0:
{
SetTimerEx("RespawnJVozila", 5000, 0, "i", vehicleid);
}
case 1:
{
SetTimerEx("RespawnJVozila", 6000, 0, "i", vehicleid);
}
case 2:
{
SetTimerEx("RespawnJVozila", 7000, 0, "i", vehicleid);
}
case 3:
{
SetTimerEx("RespawnJVozila", 8000, 0, "i", vehicleid);
}
case 4:
{
SetTimerEx("RespawnJVozila", 9000, 0, "i", vehicleid);
}
case 5:
{
SetTimerEx("RespawnJVozila", 10000, 0, "i", vehicleid);
}
default:
{
SetTimerEx("RespawnJVozila", 5000, 0, "i", vehicleid);
}
}
//ili samo ovo :D
//SetTimerEx("RespawnJVozila", 5000, 0, "i", vehicleid);
forward RespawnJVozila(vehicleid);
public RespawnJVozila(vehicleid)
{
SetVehicleToRespawn(vehicleid);
return 1;
}[/pawn]
e ako si pocetnik, ako ne znas nap provjeru ako je id tog vozila npr eo primjer 1
Citat: youngdeal poslato Januar 19, 2019, 23:26:47 POSLE PODNE
napraviš provjeru kod public OnPlayerExitVehicle
ako je vehicleid od tog vozila sto zelis bracala
npr
[pawn]new nesto = random(6);
switch(nesto)
{
case 0:
{
SetTimerEx("RespawnJVozila", 5000, 0, "i", vehicleid);
}
case 1:
{
SetTimerEx("RespawnJVozila", 6000, 0, "i", vehicleid);
}
case 2:
{
SetTimerEx("RespawnJVozila", 7000, 0, "i", vehicleid);
}
case 3:
{
SetTimerEx("RespawnJVozila", 8000, 0, "i", vehicleid);
}
case 4:
{
SetTimerEx("RespawnJVozila", 9000, 0, "i", vehicleid);
}
case 5:
{
SetTimerEx("RespawnJVozila", 10000, 0, "i", vehicleid);
}
default:
{
SetTimerEx("RespawnJVozila", 5000, 0, "i", vehicleid);
}
}
//ili samo ovo :D
//SetTimerEx("RespawnJVozila", 5000, 0, "i", vehicleid);
forward RespawnJVozila(vehicleid);
public RespawnJVozila(vehicleid)
{
SetVehicleToRespawn(vehicleid);
return 1;
}[/pawn]
e ako si pocetnik, ako ne znas nap provjeru ako je id tog vozila npr eo primjer 1
eo ovdje primjer slucajno sam enter stisnuo pa nisam mogo edit opet ahah sry za dp
[pawn]#undef MAX_VEHICLES
#define MAX_VEHICLES 2000 // LIMIT MAX VOZILA NA SERVERU NPR - AKO NEMAS OVO STAVI
new JednokratnoV[MAX_VEHICLES] = 0;
// npr u komandi
CMD:upalijednokratno(playerid)
{
if(GetPlayerState(playerid)!=PLAYER_STATE_DRIVER) return 1;
new id = GetPlayerVehicleID(playerid);
if(JednokratnoV[id] == 1) return 1;
JednokratnoV[id] = 1;
SendClientMessage(playerid,-1,"Upalio si jednokratno vozilo!");
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(JednokratnoV[vehicleid] == 1)
{
new nesto = random(6);
switch(nesto)
{
case 0:
{
SetTimerEx("RespawnJVozila", 5000, 0, "i", vehicleid);
}
case 1:
{
SetTimerEx("RespawnJVozila", 6000, 0, "i", vehicleid);
}
case 2:
{
SetTimerEx("RespawnJVozila", 7000, 0, "i", vehicleid);
}
case 3:
{
SetTimerEx("RespawnJVozila", 8000, 0, "i", vehicleid);
}
case 4:
{
SetTimerEx("RespawnJVozila", 9000, 0, "i", vehicleid);
}
case 5:
{
SetTimerEx("RespawnJVozila", 10000, 0, "i", vehicleid);
}
default:
{
SetTimerEx("RespawnJVozila", 5000, 0, "i", vehicleid);
}
}
JednokratnoV[vehicleid] = 0;
//ili samo ovo :D
// - > SetTimerEx("RespawnJVozila", 5000, 0, "i", vehicleid);
// - > JednokratnoV[vehicleid] = 0;
}
return 1;
}
forward RespawnJVozila(vehicleid);
public RespawnJVozila(vehicleid)
{
SetVehicleToRespawn(vehicleid);
return 1;
}[/pawn]
moze i na vise nacina,dao sam ti 1 primjer :D
ili eo jos 1 primjer
[pawn]
new JednokratnoV[MAX_PLAYERS] = 0;
// npr u komandi
CMD:upalijednokratno(playerid)
{
if(GetPlayerState(playerid)!=PLAYER_STATE_DRIVER) return 1;
if(JednokratnoV[playerid]!=0) return 1;
JednokratnoV[playerid] = 1;
SendClientMessage(playerid,-1,"Upalio si jednokratno vozilo!");
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(JednokratnoV[playerid]==1)
{
new nesto = random(6);
switch(nesto)
{
case 0:
{
SetTimerEx("RespawnJVozila", 5000, 0, "i", vehicleid);
}
case 1:
{
SetTimerEx("RespawnJVozila", 6000, 0, "i", vehicleid);
}
case 2:
{
SetTimerEx("RespawnJVozila", 7000, 0, "i", vehicleid);
}
case 3:
{
SetTimerEx("RespawnJVozila", 8000, 0, "i", vehicleid);
}
case 4:
{
SetTimerEx("RespawnJVozila", 9000, 0, "i", vehicleid);
}
case 5:
{
SetTimerEx("RespawnJVozila", 10000, 0, "i", vehicleid);
}
default:
{
SetTimerEx("RespawnJVozila", 5000, 0, "i", vehicleid);
}
}
JednokratnoV[playerid] = 0;
//ili samo ovo :D
// -> SetTimerEx("RespawnJVozila", 5000, 0, "i", vehicleid);
// -> JednokratnoV[playerid] = 0;
}
return 1;
}
forward RespawnJVozila(vehicleid);
public RespawnJVozila(vehicleid)
{
SetVehicleToRespawn(vehicleid);
return 1;
}[/pawn]
u 2 primjeru ce samo tom igracu koji aktivira to npr respawnat vozilo za 5 do 10 sekundi, u 1 primjeru ce 1 igraÄu koji izadje iz vozila a to je vozilo jednokratno pokrenut respawn nije bitno bio to igraÄ vozaÄ ili neki koji je npr suvozaÄ