Jump to content

CountDown Command


leon

Recommended Posts

[glow=red,2,300]CountDown Command[/glow]

[glow=red,2,300]Descriere:[/glow]

E o simpla comanda pentru a da start la un event sau un antrenament la fac?iuni .......

El nu se vede la to?i playerii de pe server ci doar în jurul playerului care a activat-o.

  • Când dai startu la un event nu mai pierzi atâta timp sa ape?i pe butoane .

[glow=red,2,300]Script:[/glow]

La #define CountDownDistance pune?i distanta la care sa se vada, eu am pus 10.0 .

#include <a_samp>

#define CountDownDistance 10.0

new	pTimer[MAX_PLAYERS];
new	nCountDown[MAX_PLAYERS];

forward CountDownStart(playerid);
forward ShowCountDown(Float:radi, playerid, string[]);

public OnPlayerConnect(playerid)
{
    nCountDown[playerid] = 4;
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/start", cmdtext, true, 10) == 0)
	{
		if(nCountDown[playerid] != 4)
		{
			SendClientMessage(playerid, 0xB4B5B7FF, "* E deja pornit timeru *");
			return 1;
		}
		nCountDown[playerid]--;
		ShowCountDown(CountDownDistance, playerid, "~g~Pe Locuri !!!");
		pTimer[playerid] = SetTimerEx("CountDownStart",1000,1,"i",playerid);
		return 1;
	}
	return 0;
}

public CountDownStart(playerid)
{
	if(nCountDown[playerid] == 3)
	{
		ShowCountDown(CountDownDistance, playerid, "~g~3");
		nCountDown[playerid]--;
	}
	else if(nCountDown[playerid] == 2)
	{
		ShowCountDown(CountDownDistance, playerid, "~b~2");
		nCountDown[playerid]--;
	}
	else if(nCountDown[playerid] == 1)
	{
		ShowCountDown(CountDownDistance, playerid, "~r~1");
		nCountDown[playerid]--;
	}
	else if(nCountDown[playerid] == 0)
	{
		ShowCountDown(CountDownDistance, playerid, "~r~GO ~y~GO ~b~GO");
		KillTimer(pTimer[playerid]);
		nCountDown[playerid] = 4;
	}
	return 1;
}

public ShowCountDown(Float:radi, playerid, string[])
{
	if(IsPlayerConnected(playerid))
	{
		new Float:posx, Float:posy, Float:posz;
		new Float:oldposx, Float:oldposy, Float:oldposz;
		new Float:tempposx, Float:tempposy, Float:tempposz;
		GetPlayerPos(playerid, oldposx, oldposy, oldposz);
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				GetPlayerPos(i, posx, posy, posz); tempposx = (oldposx -posx); tempposy = (oldposy -posy); tempposz = (oldposz -posz);
				if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
				{
					GameTextForPlayer(i, string, 2000, 4);
				}
				else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
				{
					GameTextForPlayer(i, string, 2000, 4);
				}
				else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
				{
					GameTextForPlayer(i, string, 2000, 4);
				}
				else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
				{
					GameTextForPlayer(i, string, 2000, 4);
				}
				else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
				{
					GameTextForPlayer(i, string, 2000, 4);
				}
			}
		}
	}
	return 1;
}

Nu e mare lucru da pentru încep?tori e bun .

i0418xcttya707ofg.jpg

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...

mdea

nush dak esti bou...da crek esti:D

slabule

copile ai maxim 11 ani si faci fite acuma si te dai in basini. hai mars ca nu am vazut de la tine nimic. fa tu ceva si comenteaza atuncea. nu ai tu dreptul sa il faci bou si slab. te-ai uitat la tine macar ? vai mama ta si cum a spus starxd mai si faci ca retardul 3xpost pentru ca  nu te duce capu sa citesti si tu regulamentul.

I'm back haha !

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.