Making admin command
#1

Hi. I want an admin command to insteantanously spawn the airdrop.


Код HTML:
CMD:airdrop(playerid)
{
	if(pInfo[playerid][pAdminLevel] >= 6)
	{
  SetTimer("Airdrop", 1, true);
	}
	return 1;
}
But when i type airdrop it spams airdrop continuously. I want only once without changing the timer.
Reply
#2

Because the "repeat" parameter is set true.
Reply
#3

Quote:
Originally Posted by coool
Посмотреть сообщение
Because the "repeat" parameter is set true.
Yeah but it modifies the timer of airdrop from 600000 to 1. I want only one time drop, without modifying settimer.
Reply
#4

PHP код:
SetTimer("Airdrop"1true); 
change this to
SetTimer
("Airdrop"1false); 
True means timer keeps repeating itself.
Reply
#5

Yeah but it modifies the timer.

I don't want to modify the timer, I just want to drop an airdrop instananeusly and let the timer how it is
Reply
#6

Quote:
Originally Posted by Zeus666
Посмотреть сообщение
Yeah but it modifies the timer.

I don't want to modify the timer, I just want to drop an airdrop instananeusly and let the timer how it is
So what you mean is: "I need to change the code to fix my problem but I don't want to change my code"?

If the problem is that it just keep repeating, but you only want it to happen once, then you got no other choice but to change from repeating to a non-repeating.
Reply
#7

Quote:
Originally Posted by Zeus666
Посмотреть сообщение
Код HTML:
forward Airdrop();
public Airdrop()
{

    Delete3DTextLabel(airlabel);
    DestroyObject(air);

    airlabel = Create3DTextLabel("{fff700}AIRDROP:{ffffff}This packcage has \many weapons",0xFFFFFF,306.42618, 2026.72473, 16.73662, 30, 0);

    air = CreateObject(18849, -223.3057, 991.9159, 45.1256, 0.00000, 0.00000, 0.00000);
    MoveObject(air, -222.0864, 992.7004, 19.5774, 3.0);

    for(new i=0; i < MAX_PLAYERS; i++)
    {
        DisablePlayerCheckpoint(i);
        SetPlayerCheckpoint(i, -222.0864,992.7004,19.5774,3);
    }

    SendClientMessageToAll(-1, "{ff0000}[AIRDROP]: {ffffff}Airdrop is on Fort Carson Sherrif Department.");
    printf(" ");

    new hora, minuto, segundo; gettime(hora,minuto,segundo);
    printf("> [AIRDROP]:Airdrop is on Fort Carson Sherrif Department: Ora: [%i/%i/%i]", hora, minuto, segundo);
    return 1;
}

And, I want a command of /airdrop which automatically gives the airdrop without reseting or changing timer of airdrop
You want the command to spawn ONE airdrop?

The "SetTimer" function work like this...
PHP код:
SetTimer("Name of function you want to run"interval in millisecondstrue or false if it is a repeating timer); 
So in other words, either just remove the timer in the command all together since you're still spawning it in 1 millisecond. That way you won't need to worry about canceling or "refreshing" any timer. Just call
PHP код:
Airdrop(); 
instead of
PHP код:
SetTimer("Airdrop"1true); 
and you will evade the problem.
Reply
#8

Well, I want to remain with the airdrop.

But I want to add a command to drop instantenaussly an airdrop


ex: 10 minutes = 1 airdrop. It remains 3 minutes to airdrop but i type /airdrop. 1 Airdrop comes because of admincommand, and after 3 minutes another airdrop comes too because of timer and timer resets to 10 minutes again.


My script gives me every 10 minutes an airdrop.

I just want to add an admin command to give me at every /airdrop command without modifying the airdrop timer
Reply
#9

Код:
CMD:airdrop(playerid)
{
	if(pInfo[playerid][pAdminLevel] < 6) return 0;
	Airdrop();
	return 1;
}
Reply
#10

solved. Ty.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)