Flooding a Message.
#1

Hello there, i have a problem, when im using /refuel, my car is refueling fine, but when it stops refueling, is flooding a message like this.

http://tinypic.com/view.php?pic=2ce4...8#.VI1qovl3jMg


How can i stop this flood?

Codes:

Код:
Код:
}

CMD:refuel(playerid, params[])
{
    if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
	    new vehicleid = GetPlayerVehicleID(playerid);
	    new engine,lights,alarm,doors,bonnet,boot,objective;
    	GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
	    if(engine == VEHICLE_PARAMS_ON) return SendClientMessageEx(playerid, COLOR_RED, "You need to shut off the engine before filling up (/car engine).");
	    if(!IsAtFuelStation(playerid)) return SendClientMessageEx(playerid, COLOR_RED, "You're not at a fuel station.");
	    if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_RED,"This vehicle doesn't need fuel.");
	    if(VehicleFuel[vehicleid] >= 100.0) return SendClientMessageEx(playerid, COLOR_RED, "This vehicle's tank is already full.");
	    if(RefuelingVehicle[playerid] == 1) return SendClientMessageEx(playerid, COLOR_RED, "You are refilling your vehicle's tank.");
       	SendClientMessageEx(playerid, COLOR_WHITE, "Refueling your vehicle's tank, please wait.");
       	RefuelingVehicle[playerid] = 1;
       	RefuelingVehicleTimer[playerid] = SetTimerEx("ReFill", 1000, true, "i", playerid);
	}
	return 1;
Код:
}

stock StopRefueling(playerid)
{
	GivePlayerCash(playerid, -100);
  	SendClientMessage(playerid, COLOR_WHITE,"Your vehicle's tank has been refilled for $100.");

	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] = 6000);
	return true;
}
I changed this

Код:
SendFormattedMessage(playerid, COLOR_WHITE,"Your vehicle's tank has been refilled for $100.");
To this

Код:
SendClientMessage(playerid, COLOR_WHITE,"Your vehicle's tank has been refilled for $100.");
But nothing happens, So, how can i stop this flood?
Reply
#2

Not sure

pawn Код:
KillTimer(RefuelingVehicleTimer[playerid] = 6000);
CHANGE

pawn Код:
KillTimer(RefuelingVehicleTimer[playerid]);
Reply
#3

Quote:
Originally Posted by Ryz
Посмотреть сообщение
Not sure

pawn Код:
KillTimer(RefuelingVehicleTimer[playerid] = 6000);
CHANGE

pawn Код:
KillTimer(RefuelingVehicleTimer[playerid]);
Not working, anyone?
Reply
#4

pawn Код:
RefuelingVehicleTimer[playerid] = SetTimerEx("ReFill", 1000, true, "i", playerid);
This, you are repeating the timer!

pawn Код:
RefuelingVehicleTimer[playerid] = SetTimerEx("ReFill", 1000, false, "i", playerid);
Change to this.
Reply
#5

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
pawn Код:
RefuelingVehicleTimer[playerid] = SetTimerEx("ReFill", 1000, true, "i", playerid);
This, you are repeating the timer!

pawn Код:
RefuelingVehicleTimer[playerid] = SetTimerEx("ReFill", 1000, false, "i", playerid);
Change to this.
If you analyze it better you'd see that he has a StopRefueling function. If you use common sense you'd realize that he wants it to repeat.


Show all the code, and properly this time. It's hard to find the problem with what you gave us.

You can kill the timer with (Once you've refueled your vehicle):

pawn Код:
KillTimer(RefuelingVehicleTimer[playerid]);
Reply
#6

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
If you analyze it better you'd see that he has a StopRefueling function. If you use common sense you'd realize that he wants it to repeat.


Show all the code, and properly this time. It's hard to find the problem with what you gave us.

You can kill the timer with (Once you've refueled your vehicle):

pawn Код:
KillTimer(RefuelingVehicleTimer[playerid]);
If you paid even more attention you would see that he tried that didn't work and it's ridiclous he's repeating the timer then killing it, why doing that when you can cut it from the first.
Reply
#7

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
If you paid even more attention you would see that he tried that didn't work and it's ridiclous he's repeating the timer then killing it, why doing that when you can cut it from the first.
"he's repeating the timer then killing it" - That's what the function is for. Once you kill it, it won't execute anymore.

Probably he wants the fuel to increment each second, who knows.
Reply
#8

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
pawn Код:
RefuelingVehicleTimer[playerid] = SetTimerEx("ReFill", 1000, true, "i", playerid);
This, you are repeating the timer!

pawn Код:
RefuelingVehicleTimer[playerid] = SetTimerEx("ReFill", 1000, false, "i", playerid);
Change to this.
Well, with this one

Код:
RefuelingVehicleTimer[playerid] = SetTimerEx("ReFill", 1000, false, "i", playerid);
There is no message lol... Any ideas?
Reply
#9

This sounds like an NGG edit to me if I didn't know any better... That's why you shouldn't rely on someone else's scripting and actually script it for yourself.
Reply
#10

Quote:
Originally Posted by ******
Посмотреть сообщение
You probably need to show your "ReFill" function.
I don't think that there is a problem in this code.

Код:
}

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


Forum Jump:


Users browsing this thread: 1 Guest(s)