spam bug -
vection - 22.08.2010
pawn Код:
public housetimer()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
for(new m=0;m<MAX_HOUSES;m++)
{
if(PlayerToPoint(4.0, i,h2Info[m][iconx],h2Info[m][icony],h2Info[m][iconz]))
{
new str2[256];
new string[256];
if(checkhouse[i] == 0)
{
GetHouseStats(i, GetHouseID(i));
checkhouse[i] = 1;
}
}
else
{
DisablePlayerCheckpoint(i);
checkhouse[i] = 0;
}
}
}
}
Part of housestats code..
if(PlayerToPoint(4.0, playerid,h2Info[hid][iconx],h2Info[hid][icony],h2Info[hid][iconz]))
{
if(checkhouse[playerid] == 0)
{
SetPlayerCheckpoint(playerid, h2Info[hid][iconx], h2Info[hid][icony], h2Info[hid][iconz], 2);
format(string, sizeof(string), "You'r standing on %s's porch", h2Info[hid][Name]);
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
checkhouse[playerid] = 1;
}
}
else
{
if(checkhouse[playerid] == 1)
{
DisablePlayerCheckpoint(playerid);
checkhouse[playerid] = 0;
}
}
Problems:
1. When i connect its spam to me .
2. When i placed on one of the houeses spam too.
3. Checkpoint didnt create.
Re: spam bug -
iggy1 - 22.08.2010
Could you show the complete housestats code? You might be using SendClientMessage on a loop to "playerid" instead of "i".
Re: spam bug -
vection - 22.08.2010
Yes, in housestats code i using playerid .
pawn Код:
stock GetHouseStats(playerid, hid)
{
new str2[256];
new string[256];
if(!strcmp(h2Info[hid][Renter],"ForRent",true))
{
//format(str2, sizeof(str2), "~w~This House Owned by ~r~ %s ~w~ Cost: ~r~ $%d ~w~ rent cost:~r~ $%i", h2Info[hid][Name], h2Info[hid][Cost], h2Info[hid][Rentcost]);
if(PlayerToPoint(4.0, playerid,h2Info[hid][iconx],h2Info[hid][icony],h2Info[hid][iconz]))
{
if(checkhouse[playerid] == 0)
{
SetPlayerCheckpoint(playerid, h2Info[hid][iconx], h2Info[hid][icony], h2Info[hid][iconz], 2);
format(string, sizeof(string), "You'r standing on %s's porch", h2Info[hid][Name]);
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
checkhouse[playerid] = 1;
}
}
else
{
if(checkhouse[playerid] == 1)
{
DisablePlayerCheckpoint(playerid);
checkhouse[playerid] = 0;
}
}
}
else if(!strcmp(h2Info[hid][Name],"ForSale",true))
{
//format(str2, sizeof(str2), "~w~This House For Sale", h2Info[hid][Name]);
if(PlayerToPoint(4.0, playerid,h2Info[hid][iconx],h2Info[hid][icony],h2Info[hid][iconz]))
{
if(checkhouse[playerid] == 0)
{
SetPlayerCheckpoint(playerid, h2Info[hid][iconx], h2Info[hid][icony], h2Info[hid][iconz], 2);
format(string, sizeof(string), "This House for sale, and cost $%d", h2Info[hid][Cost]);
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
checkhouse[playerid] = 1;
}
}
else
{
if(checkhouse[playerid] == 1)
{
DisablePlayerCheckpoint(playerid);
checkhouse[playerid] = 0;
}
}
}
else
{
//format(str2, sizeof(str2), "~w~This House Owned by ~r~ %s", h2Info[hid][Name]);
if(PlayerToPoint(4.0, playerid,h2Info[hid][iconx],h2Info[hid][icony],h2Info[hid][iconz]))
{
if(checkhouse[playerid] == 0)
{
SetPlayerCheckpoint(playerid, h2Info[hid][iconx], h2Info[hid][icony], h2Info[hid][iconz], 2);
format(string, sizeof(string), "This House for sale, and cost $%d", h2Info[hid][Cost]);
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
checkhouse[playerid] = 1;
}
}
else
{
if(checkhouse[playerid] == 1)
{
DisablePlayerCheckpoint(playerid);
checkhouse[playerid] = 0;
}
}
}
//GameTextForPlayer(playerid, str2, 5000, 3);
}
this is the problem ?
Re: spam bug -
iggy1 - 22.08.2010
Not sure m8 its not what i thought was causing it i thought u might have had a loop in housestats like that is simalar to this
pawn Код:
for(new i;i<=MAX_PLAYERS;i++)
{
if(IsPlayerInVehicle(i))
{
SendClientMessage(playerid,0xff0000FF,"blahblahblah");//will only send player id the message not the player that is being looped
}
}
Sorry pal
EDIT: what message do you get spammed?
Re: spam bug -
vection - 22.08.2010
i talk about this message:
pawn Код:
format(string, sizeof(string), "You'r standing on %s's porch", h2Info[hid][Name]);
Re: spam bug -
vection - 22.08.2010
If i use with pickup, its work well. but i want to make like this:
when i go near the house the checkpoint apear, than show the stats.
when player leave this area checkpoint disapear and stats gone = non spamming.
Re: spam bug -
iggy1 - 22.08.2010
So are you using OnPlayerEnterCheckpoint?
Re: spam bug -
vection - 22.08.2010
Quote:
Originally Posted by iggy1
So are you using OnPlayerEnterCheckpoint?
|
Ok i change the system to work with OnPlayerEnterCheckpoint.
so its look like this:
pawn Код:
public housetimer2()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
for(new m=0;m<MAX_HOUSES;m++)
{
if(PlayerToPoint(4, i, h2Info[m][iconx], h2Info[m][icony], h2Info[m][iconz]))
{
CP[i] = 69;
SetPlayerCheckpoint(i, h2Info[m][iconx], h2Info[m][icony], h2Info[m][iconz], 2);
}
else
{
if(backupst[i] == 0)
{
CP[i] = 0;
DisablePlayerCheckpoint(i);
}
}
}
}
}
public OnPlayerEnterCheckPoint
{
if (CP[playerid]==69)
{
GetHouseStats(playerid, GetHouseID(playerid));
}
}
still didnt work. i mean, when i come near the house the checkpoint is not apear.
so i think the problem in the housetimer2 timer.
but i couldnt find what the problem...
Re: spam bug -
iggy1 - 22.08.2010
If you use a streamer that streams checkpoints they can conflict. Also if you dont use a streamer try incognitos streamer you can create checkpoints for all players in one fuction and it has a checkpointid parameter meaning you can get rid of that timer with the two loops. And just do the following.
pawn Код:
new CPID[MAX_HOUSES];//global
prefferably inside the funtion that ceates your houses.
pawn Код:
CPID[houseid] = CreateDynamicCP(h2Info[m][iconx], h2Info[m][icony], h2Info[m][iconz]2.0,0,0,-1,50.0);
public OnPlayerEnterDynamicCP(playerid, checkpointid)
pawn Код:
for(new h; h<=MAX_HOUSES;h++)
{
if(checkpointid == CPID[h])
{
//do stuff here eg, show stats
}
}
Its alot simpler than the code you have and also more efficient. Note CreateDynamicCP is for all players if the second to last parameter is -1. But it will only stream 1 a time per player
Re: spam bug -
vection - 22.08.2010
hmm i plugin right now the streamer
pawn Код:
error 001: expected token: ",", but found "-rational value-"
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
anyway thats not what i would like to do.
i mean to make a checkpoint that disapear.
Apear when you near the house, and after disapear when you move around.
you gave to me code, the checkpoint not disapear so its like a pickup.
and all saw this checkpoints. so i think its not what i asking for.
maybe i dont understand you well. anyway i got this errors.