CountDown Command
:: Diverse :: San Andreas Multiplayer :: ScriptFiles
Pagina 1 din 1
CountDown Command
CountDown Command
Descriere:
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 .
Script:
La #define CountDownDistance pune?i distanta la care sa se vada, eu am pus 10.0 .
Descriere:
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 .
Script:
La #define CountDownDistance pune?i distanta la care sa se vada, eu am pus 10.0 .
- Cod:
#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;
}
R3ALL- Membru, skill +9
- Mesaje : 479
Data de inscriere : 28/08/2012
Varsta : 28
Localizare : Bucuresti
:: Diverse :: San Andreas Multiplayer :: ScriptFiles
Pagina 1 din 1
Permisiunile acestui forum:
Nu puteti raspunde la subiectele acestui forum
|
|