Question| How...???
#1

Hey i got a command that make GameText for the player who did the command

Now i need command that will remove the GameText for himm... and i dont know how there is any RemoveGameTextForPlayer function
Reply
#2

https://sampwiki.blast.hk/wiki/GameTextForPlayer

Parameters:
(playerid, const string[], time, style)
playerid The playerid to show the text to.
const string[] The text you want to display on the screen.
time The time you want the text to show up, in milliseconds.
style The style you want to show the text in.


Reply
#3

But how can i remove the gametext by command

like /off and it'll remove the gametext
Reply
#4

where you enter the time will be how long the gametext is displayed for....

so if you put 4000 you will only see it for 4 seconds
Reply
#5

Quote:
Originally Posted by [Sk
Noob ]
But how can i remove the gametext by command

like /off and it'll remove the gametext
I tink will work if on /off command you put another gametext wich stay only for a few secconds ( i'm not shoure if will work)
Reply
#6

Ok look this is the problem i got it..

Код:
	if(strcmp(cmdtext, "/counter", true) == 0)
 {
 if(IsPlayerConnected(playerid))
 {
 	new tmpcar = GetPlayerVehicleID(playerid) - 1;
	if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 5)
	{
	if(!IsPlayerInAnyVehicle(playerid))
 	{
 	SendClientMessage(playerid, COLOR_VEH, " You are not in a car.");
	return 1;
 	}
	if(DynamicCars[tmpcar][FactionCar] != PlayerInfo[playerid][pFaction])
	{
	SendClientMessage(playerid, COLOR_VEH, " You are not in a faction vehicle.");
	return 1;
	}
	PlayerActionMessage(playerid,15.0,"turns on the counter.");
	SetTimer("countdown",500,0);
	}
	}
	else
	{
	SendClientMessage(playerid, COLOR_VEH, "Invalid Faction.");
	return 1;
	}}
and
Код:
forward countdown(playerid);
public countdown(playerid)
{
static loops = 10;
if (loops)
{
new cdtimer = SetTimer("countdown", 3000, 0);
#pragma unused cdtimer
new str[256];
format(str, sizeof (str), "~w~Counter: %d$", loops);
GameTextForPlayer(playerid,str,1000,4);
for(new i=0; i<MAX_PLAYERS; i++) {
if (IsPlayerConnected(i))
{
}
}
loops++;
}
else
{
for(new i=0; i<MAX_PLAYERS; i++) {
{
if (IsPlayerConnected(i))
{

}
}
loops = 10;
}
}
}
This is with Timer So how can i remove it by command ?? like /counter off
Reply
#7

to stop the timer?

Top of script:

Код:
new KillCountDown;
Код:
 if(strcmp(cmdtext, "/counter", true) == 0)
 {
 if(IsPlayerConnected(playerid))
 {
 	new tmpcar = GetPlayerVehicleID(playerid) - 1;
	if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 5)
	{
	if(!IsPlayerInAnyVehicle(playerid))
 	{
 	SendClientMessage(playerid, COLOR_VEH, " You are not in a car.");
	return 1;
 	}
	if(DynamicCars[tmpcar][FactionCar] != PlayerInfo[playerid][pFaction])
	{
	SendClientMessage(playerid, COLOR_VEH, " You are not in a faction vehicle.");
	return 1;
	}
	PlayerActionMessage(playerid,15.0,"turns on the counter.");
	KillCountDown = SetTimer("countdown",500,0);
	}
	}
	else
	{
	SendClientMessage(playerid, COLOR_VEH, "Invalid Faction.");
	return 1;
	}}
for the command you wanna stop it with use:

Код:
KillTimer(KillCountDown);
Reply
#8

Not working can you maybe do it for me
Reply
#9

Okay now its working but i got now only one problem with the commands... they're working but when i am doing /counter of /counter off its says : Unknown command but its working... whats the prob here?
Reply
#10

In your command functions you have to return 1 in place of return 0....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)