SA-MP Forums Archive
Need urgent help witgh some text spamming randomly. - 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: Need urgent help witgh some text spamming randomly. (/showthread.php?tid=408689)



Need urgent help witgh some text spamming randomly. - Desi_Dude - 19.01.2013

This happens randomly to some players , well , it'll not stop till server is restarted manually..




Код:
stock StopRefueling(playerid)
{
	GivePlayerCash(playerid, -RefuelingVehiclePrice[playerid]);
	SendFormattedMessage(playerid, COLOR_WHITE,"Your vehicle's tank has been refilled for $%d.", RefuelingVehiclePrice[playerid]);

	new mypoint = -1;
	for (new i=0; i<MAX_POINTS; i++)
	{
		if(strcmp(Points[i][Name], "Fossil Fuel Company", true) == 0)
		{
			mypoint = i;
		}
	}
	for(new i = 0; i < sizeof(FamilyInfo); i++)
	{
		if(strcmp(Points[mypoint][Owner], FamilyInfo[i][FamilyName], true) == 0)
		{
			FamilyInfo[i][FamilyBank] = FamilyInfo[i][FamilyBank]+(RefuelingVehiclePrice[playerid]/10);
		}
	}

	RefuelingVehicle[playerid] = 0; RefuelingVehiclePrice[playerid] = 0; KillTimer(RefuelingVehicleTimer[playerid]);
	return true;
}
Any Ideas ? why ?:/


Re: Need urgent help witgh some text spamming randomly. - gnoomen2 - 19.01.2013

Hey, It appears the message is from this line:

pawn Код:
SendFormattedMessage(playerid, COLOR_WHITE,"Your vehicle's tank has been refilled for $%d.", RefuelingVehiclePrice[playerid]);
You can try to remove that line and the i think the message should be gone, Why this happens i dont know :/

There might be a timer that starts and starts. You can check out the "SetTimer" or "SetTimerEx" function, and try to seach for it in your GM. Good luck!


Re: Need urgent help witgh some text spamming randomly. - RajatPawar - 19.01.2013

Try adding lines after the formatted message, in the for loops and run it to see what is actually being executed!


Re: Need urgent help witgh some text spamming randomly. - Patrick - 19.01.2013

Try this

pawn Код:
stock StopRefueling(playerid)
{
    new mypoint = -1;
    for (new i=0; i<MAX_POINTS; i++)
    {
        if(strcmp(Points[i][Name], "Fossil Fuel Company", true) == 0)
        {
            mypoint = i;
        }
    }
    for(new i = 0; i < sizeof(FamilyInfo); i++)
    {
        if(strcmp(Points[mypoint][Owner], FamilyInfo[i][FamilyName], true) == 0)
        {
            FamilyInfo[i][FamilyBank] = FamilyInfo[i][FamilyBank]+(RefuelingVehiclePrice[playerid]/10);
        }
    }

    RefuelingVehicle[playerid] = 0; RefuelingVehiclePrice[playerid] = 0; KillTimer(RefuelingVehicleTimer[playerid]);
    GivePlayerCash(playerid, -RefuelingVehiclePrice[playerid]);
    SendFormattedMessage(playerid, COLOR_WHITE,"Your vehicle's tank has been refilled for $%d.", RefuelingVehiclePrice[playerid]);
    return true;
}



Re: Need urgent help witgh some text spamming randomly. - Vince - 19.01.2013

That message appears pretty much as the first thing in the function, so you'll need to go look higher up. Look for the function that calls StopRefueling in the first place.


Re: Need urgent help witgh some text spamming randomly. - Black Wolf - 19.01.2013

yeah looks like the func is getting called again and again.


Re: Need urgent help witgh some text spamming randomly. - Desi_Dude - 22.01.2013

I'm sorry for replying late - But it isn't working either . I tried adding lines after the formatted message, It isn't working just as
Quote:
pawn Код:
stock StopRefueling(playerid)
{
    new mypoint = -1;
    for (new i=0; i<MAX_POINTS; i++)
    {
        if(strcmp(Points[i][Name], "Fossil Fuel Company", true) == 0)
        {
            mypoint = i;
        }
    }
    for(new i = 0; i < sizeof(FamilyInfo); i++)
    {
        if(strcmp(Points[mypoint][Owner], FamilyInfo[i][FamilyName], true) == 0)
        {
            FamilyInfo[i][FamilyBank] = FamilyInfo[i][FamilyBank]+(RefuelingVehiclePrice[playerid]/10);
        }
    }

    RefuelingVehicle[playerid] = 0; RefuelingVehiclePrice[playerid] = 0; KillTimer(RefuelingVehicleTimer[playerid]);
    GivePlayerCash(playerid, -RefuelingVehiclePrice[playerid]);
    SendFormattedMessage(playerid, COLOR_WHITE,"Your vehicle's tank has been refilled for $%d.", RefuelingVehiclePrice[playerid]);
    return true;
}
It's still not working - spamming messages keeps coming at random times..


Re: Need urgent help witgh some text spamming randomly. - Scenario - 22.01.2013

Vince and Black Wolf are correct. Look where you are calling the StopRefueling() function because it appears to be calling that function more than once.


Re: Need urgent help witgh some text spamming randomly. - Desi_Dude - 22.01.2013

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Vince and Black Wolf are correct. Look where you are calling the StopRefueling() function because it appears to be calling that function more than once.
This is the other function i can find using StopRefueling()
Код:
forward ReFill(playerid);
public ReFill(playerid)
{
	if(!IsAtFuelStation(playerid) || !IsPlayerInAnyVehicle(playerid) || VehicleFuel[GetPlayerVehicleID(playerid)] >= 100.0 || GetPlayerCash(playerid) < 1)
	{
		StopRefueling(playerid);
	}
	else
	{
		new engine,lights,alarm,doors,bonnet,boot,objective;
		GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
		if(engine == VEHICLE_PARAMS_ON) return StopRefueling(playerid);
		VehicleFuel[GetPlayerVehicleID(playerid)] += 1.0; RefuelingVehiclePrice[playerid] += 30;
		if(VehicleFuel[GetPlayerVehicleID(playerid)] >= 100.0) VehicleFuel[GetPlayerVehicleID(playerid)] = 100.0;
	}
	return true;
}



Re: Need urgent help witgh some text spamming randomly. - iGetty - 22.01.2013

Can you show the SendFormattedMessage stock?