27.02.2009, 23:35
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()
{

