OnPlayerEnterCP
#1

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 !");
  }
  }
  }
Reply
#2

Remove the message outside the loop
Reply
#3

can u explain me why message spam?
Reply
#4

Because it's inside the loop and the message is going to be reapeated

Код:
for(new idvozila = 280; idvozila <= 284; idvozila++)
	{
Reply
#5

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!
Reply
#6

does he repeat the other commands as well?

Rep added for Hunud and Kraeror
Reply
#7

I do not want to repeat it, but I need it "for new.." because of "idvozila" to -1
Reply
#8

Код:
  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 
  }
  }
  }
Reply
#9

Thanks to all ! Lock
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)