not working well - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: not working well (
/showthread.php?tid=620176)
not working well -
StR_MaRy - 27.10.2016
hey guys i have a command that fix a generator .. but is a small problem if i am alone on the server it's working well but if someone or more join the server i get a message that shouldn't be there in that moment.
the command is:
Код HTML:
CMD:fixit(playerid)
{
if(gLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
if(Killer[playerid] == 1) return SendClientMessage(playerid, COLOR_ERROR, "Nu poti folosi comanda, nu poti lasa supravietuitori sa scape!");
if(Pyromaniac[playerid] == 1) return SendClientMessage(playerid, COLOR_ERROR, "Nu poti folosi comanda, nu poti lasa supravietuitori sa scape!");
foreach(new i : Player)
{
if(Survivor[playerid] == 1)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, -1182.1416, -1008.2070, 129.2188))
{
if(GeneratorOcupat[0] == 1) return SendClientMessage(playerid, COLOR_SYN, "(!) {FFFFFF}Cineva repara acest generator!");
if(Generator[0] == 1) return SendClientMessage(playerid, COLOR_SYN, "(!) {FFFFFF}Acest generator a fost deja reparat!");
ApplyAnimation(playerid,"BOMBER", "BOM_Plant",4.0,1,0,0,1,10000,1);
generatorreparat[0] = SetTimerEx("generatorreparat0",10200, false, "i", playerid);
SetTimerEx("generatorbug",100, false, "i", playerid);
GeneratorOcupat[0] = 1;
}
}
}
}
and this message says:
Код HTML:
if(GeneratorOcupat[0] == 1) return SendClientMessage(playerid, COLOR_SYN, "(!) {FFFFFF}Cineva repara acest generator!");
Translate: Someone already repairing this generator
but the thing is no one is near me or the generator and i get that message

why ?
that message should give it to someone who try to repair the same generator with another player in the same time
Re: not working well - iLearner - 27.10.2016
Did you set GeneratorOcupat[0] =0; once its free?
Re: not working well -
StR_MaRy - 27.10.2016
ofc

at the start new GeneratorOcupat[12]; for 12 generators if i put new GeneratorOcupat[12] = 0; is the same
Re: not working well - iLearner - 27.10.2016
Show me the code where you free the generator & set it to 0.
Re: not working well -
StR_MaRy - 27.10.2016
Код HTML:
new GeneratorOcupat[13];
and
Код HTML:
GeneratorOcupat[0] = 0;
this code is called when the timer is ended from the command /fixit