OnPlayerEnterCP - 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: OnPlayerEnterCP (
/showthread.php?tid=646823)
OnPlayerEnterCP -
Wucha - 24.12.2017
I have problem with reapeating SCM(playerid, -1, "[POSAO] {dd750d}Vratite se po ostale dzakove !");
Код:
[21:40:40] [POSAO] {dd750d}Vratite se po ostale dzakove !
[21:40:40] [POSAO] {dd750d}Vratite se po ostale dzakove !
[21:40:40] [POSAO] {dd750d}Vratite se po ostale dzakove !
[21:40:40] [POSAO] {dd750d}Vratite se po ostale dzakove !
[21:40:40] [POSAO] {dd750d}Vratite se po ostale dzakove !
Код:
if(CP[playerid] == 1111)
{
if(IsPlayerInRangeOfPoint(playerid, 4.0, 1709.8755,-1129.6815,24.1907))
{
for(new idvozila = 280; idvozila <= 284; idvozila++)
{
if(DzakoviVozila[idvozila] == 1) return SCM(playerid, -1, "[POSAO] {dd750d}Istovarili ste sve dzakove !");
DisablePlayerCheckpoint(playerid);
SetPlayerSpecialAction( playerid, SPECIAL_ACTION_NONE);
RemovePlayerAttachedObject(playerid, 0);
DzakoviVozila[idvozila] -= 1;
DestroyPlayerObject(playerid,0);
LoopingAnim(playerid,"MISC","PASS_RIFLE_PED",3.1,0,1,1,1,1);
SCM(playerid, -1, "[POSAO] {dd750d}Vratite se po ostale dzakove !");
}
}
}
Re: OnPlayerEnterCP -
Hunud - 24.12.2017
Remove the message outside the loop
Re: OnPlayerEnterCP -
Wucha - 24.12.2017
can u explain me why message spam?
Re: OnPlayerEnterCP -
Hunud - 24.12.2017
Because it's inside the loop and the message is going to be reapeated
Код:
for(new idvozila = 280; idvozila <= 284; idvozila++)
{
Re: OnPlayerEnterCP -
Kraeror - 24.12.2017
The problem is because the message is in loop, in this case the loop is sending 4 messages because the loop is from 280 to 284, so 284-280 equals 4!
You have to remove this from the loop!
+1 REP if You understand!
Re: OnPlayerEnterCP -
Wucha - 24.12.2017
does he repeat the other commands as well?
Rep added for Hunud and Kraeror
Re: OnPlayerEnterCP -
Wucha - 24.12.2017
I do not want to repeat it, but I need it "for new.." because of "idvozila" to -1
Re: OnPlayerEnterCP -
SintaksTR - 24.12.2017
Код:
if(CP[playerid] == 1111)
{
if(IsPlayerInRangeOfPoint(playerid, 4.0, 1709.8755,-1129.6815,24.1907))
{
for(new idvozila = 280; idvozila <= 284; idvozila++)
{
if(DzakoviVozila[idvozila] == 1) return SCM(playerid, -1, "[POSAO] {dd750d}Istovarili ste sve dzakove !");
DisablePlayerCheckpoint(playerid);
SetPlayerSpecialAction( playerid, SPECIAL_ACTION_NONE);
RemovePlayerAttachedObject(playerid, 0);
DzakoviVozila[idvozila] -= 1;
DestroyPlayerObject(playerid,0);
LoopingAnim(playerid,"MISC","PASS_RIFLE_PED",3.1,0,1,1,1,1);
SCM(playerid, -1, "[POSAO] {dd750d}Vratite se po ostale dzakove !");
break; // Stop the loop
}
}
}
Re: OnPlayerEnterCP -
Wucha - 24.12.2017
Thanks to all !
Lock