checkpoint info spam
#1



ok I have a modified version of bmuk's lvrcr i ripped out all the dumb logic but i cannot figure out wtf the problem is with this spam.

Here is what happens... I enter the checkpoint.. it works and does what its supposed to but it will spam my chat over and over with the info. for instance the wang cars when i enter it gives you a list of cars to buy but it just spams it instead of just displaying it one time.

Here is my code. and it does it to ALL checkpoints.

Код:
public getCheckpointType(playerID) {
return checkpointType[playerCheckpoint[playerID]];
}


public isPlayerInArea(playerID, index)
{
	new Float:X, Float:Y, Float:Z;
	new Float:cX,Float:cY;
	new Float:r1;
	
	cX=checkpoints[index][0];cY=checkpoints[index][1];
	r1=CHECKPOINT_AREA;

	GetPlayerPos(playerID, X, Y, Z);
	if((cX-r1<X)&&(cX+r1>X)&&(cY-r1<Y)&&(cY+r1>Y))
	{ print("In Area =1");return 1;}else{ print("In Area =0");return 0;}
}

public checkpointUpdate()
{
	new Float:x,Float:y,Float:z;
	new Float:x1,Float:y1;//,Float:z1;
	new Float:r1=CHECKPOINT_AREA;
	new Float:a,Float:b,Float:c;
	new iy;

//	print("checkpointupdate():");
	for(iy=0;iy<MAX_PLAYERS;iy++)
	{
	  if(IsPlayerConnected(iy))
	  {
	    pPlyrCDist[iy][0]=9999.99;
	    pPlyrChkpt[iy][0]=9999;

			GetPlayerPos(iy,x,y,z);
			for(new ix=0;ix<MAX_POINTS;ix++)
			{
			  x1=checkpoints[ix][0];
			  y1=checkpoints[ix][1];
			  //z1=checkpoints[ix][2];
  			 // printf("x:%f y:%f z:%f",x1,y1,z1);
  			  if((x1-r1<x)&&(x1+r1>x)&&(y1-r1<y)&&(y1+r1>y))
  			  {
				//	print("In Area=1");
				
					a=(x-x1)*(x-x1);
  			    b=(y-y1)*(y-y1);
  			    c=floatsqroot(floatadd(a,b));
  			    
  			    if(c<pPlyrCDist[iy][0])
  			    {
  			      pPlyrCDist[iy][0]=c;
  			      pPlyrChkpt[iy][0]=ix;
					}
						
				}
			}
		}
	}
	checkpointStream();
}

stock checkpointStream()
{
	new id;
	for(new iy=0;iy<MAX_PLAYERS;iy++)
	{
	  if(pPlyrChkpt[iy][0]!=9999)
	  {
	    new Float:cpSize=checkpoints[id][3];
			id=pPlyrChkpt[iy][0];
			playerCheckpoint[iy]=id;
		 	SetPlayerCheckpoint(iy,checkpoints[id][0],checkpoints[id][1],checkpoints[id][2],cpSize);
	  }
	  else
	  {
			DisablePlayerCheckpoint(iy);
      playerCheckpoint[iy]=999;
		}
	}
}

public OnGameModeInit()
{
Reply
#2

use sommat like a variable CheckPointEntered, When they in it set it to 1, Then when they go out set it to 0, Then with the info do if(CheckPointEntered[playerid] == 0), then sendthe info and set it to 1
Reply
#3

Could do that but its too much work and it still isnt solving the problem, that would just solve the result. Need to figure out why it keeps running and checkin OnPlayerEnterCheckpoint because it just spames the messages it sends you in the particular routine for that checkpoint.

Код:
public OnPlayerEnterCheckpoint(playerid)
{
  // CheckpointCheck(playerid);

	new string[256];
  
  if(getCheckpointType(playerid) == 89 && getCheckpointType(playerid) == 89)
  {
  SendClientMessage(playerid, 0xA9A9A9AA, "|_LV City Hall Administration Dept_|");
  SendClientMessage(playerid,0x00C7FFAA,"Type /robhall to attempt a robbery at LV City Hall");
  }
If i walk in the checkpointtype 89 it will spam those messages.
Reply
#4

then destroy it when you walk into it, ofc it will be called constanly becuase the checkpoint is still there
Reply
#5

destroy what? the checkpoint? hmm... i dont think thats how it was done before... thanks for your help man
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)