Need urgent help witgh some text spamming randomly.
#1

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 ?:/
Reply
#2

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

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

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;
}
Reply
#5

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

yeah looks like the func is getting called again and again.
Reply
#7

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..
Reply
#8

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.
Reply
#9

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;
}
Reply
#10

Can you show the SendFormattedMessage stock?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)