SA-MP Forums Archive
Making admin command - 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: Making admin command (/showthread.php?tid=648450)



Making admin command - Zeus666 - 22.01.2018

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.


Re: Making admin command - coool - 22.01.2018

Because the "repeat" parameter is set true.


Re: Making admin command - Zeus666 - 22.01.2018

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.


Re: Making admin command - Inn0cent - 22.01.2018

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


Re: Making admin command - Zeus666 - 22.01.2018

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


Re: Making admin command - MarikAshtar - 22.01.2018

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.


Re: Making admin command - MarikAshtar - 22.01.2018

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.


Re: Making admin command - Zeus666 - 22.01.2018

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


Re: Making admin command - Rolux - 22.01.2018

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



Re: Making admin command - Zeus666 - 22.01.2018

solved. Ty.