Код:
#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
#pragma tabsize 0
#define COLOR_RED 0xFF0000AA // Red
#define COLOR_YELLOW 0xFFFF00AA // Yellow
#define COLOR_GREEN 0x66CC99AA // Green
#define COLOR_BLUE 0x0000BBAA // Blue
new Duelo[MAX_PLAYERS];
new EDuelo;
new EnDuelo;
new CountDown= -1;
forward CountTimer();
forward CountFin(playerid);
stock Conteo()
{
CountDown= 6;
return SetTimer("CountTimer", 1000, 0);
}
public OnFilterScriptInit()
{
print("----------------------------------------");
print("------Sistema de Duelos por leaNN!------");
print("----------------------------------------");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(Duelo[playerid] == 1)
{
EnDuelo = 0;
Duelo[playerid] = 0;
SendClientMessage(playerid, COLOR_GREEN, "Tu contrincante ha ganado!");
}
else if(Duelo[killerid] == 1)
{
EnDuelo = 0;
Duelo[killerid] = 0;
SendClientMessage(killerid, COLOR_GREEN, "Has ganado el duelo!");
}
return 1;
}
//========================================================Sistema de Duelos!
CMD:duelo(playerid, params[])
{
if(EnDuelo == 1) return SendClientMessage(playerid, COLOR_BLUE, "Ya hay un duelo en curso!");
else if(EnDuelo == 0){
EnDuelo = 1;
new rid;
new pname[MAX_PLAYER_NAME], string[128 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s dice: Te animas a un duelo?", pname);
EDuelo = playerid;
if(sscanf(params, "d", rid)) return SendClientMessage(playerid, COLOR_YELLOW, "Use /duelo [playerid/name]");
else if(!IsPlayerConnected(rid)) return SendClientMessage(playerid, COLOR_BLUE, "Este jugador no esta conectado");
else
{
SendClientMessage(rid, COLOR_BLUE, string);
SendClientMessage(rid, COLOR_GREEN, "Usa /aceptar para aceptar el Duelo y /rechazar para rechazarlo!");
Duelo[rid] = 1;
}
}
return 1;
}
CMD:aceptar(playerid, params[])
{
if(Duelo[playerid] == 0) return SendClientMessage(playerid, COLOR_YELLOW, "Nadie te ha invitado a un Duelo!");
if(Duelo[playerid] == 1)
{
Duelo[playerid] = 0;
new pname[MAX_PLAYER_NAME], string[128 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s acepto el duelo!", pname);
SendClientMessage(EDuelo, COLOR_YELLOW, string);
SetPlayerPos(playerid, 1549.3807,-1625.3434,13.3828);
SetPlayerPos(EDuelo, 1549.3807,-1625.3434,13.3828);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerVirtualWorld(EDuelo, 0);
TogglePlayerControllable(playerid, 0);
TogglePlayerControllable(EDuelo, 0);
GivePlayerWeapon(playerid, 22, 10000);
GivePlayerWeapon(EDuelo, 28, 10000);
GivePlayerWeapon(playerid, 28, 10000);
GivePlayerWeapon(EDuelo, 22, 10000);
ResetPlayerWeapons(playerid);
ResetPlayerWeapons(EDuelo);
SetPlayerHealth(playerid, 100);
SetPlayerHealth(EDuelo, 100);
SetPlayerArmour(playerid, 100);
SetPlayerArmour(EDuelo, 100);
Conteo();
SetTimer("CountFin", 6000, 0);
}
return 1;
}
CMD:rechazar(playerid, params[])
{
if(Duelo[playerid] == 0) return SendClientMessage(playerid, COLOR_YELLOW, "Nadie te ha invitado a un Duelo!");
if(Duelo[playerid] == 1)
{
EnDuelo = 0;
Duelo[playerid] = 0;
new pname[MAX_PLAYER_NAME], string[128 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s rechazo el duelo es un cagon!", pname);
SendClientMessage(EDuelo, COLOR_RED, string);
}
return 1;
}
//====================================================Fin Sistema de Duelos!
//------------------------------Sscanaf-----------------------------------------
stock sscanf(string[], format[], {Float,_}:...)
{
new
formatPos = 0,
stringPos = 0,
paramPos = 2,
paramCount = numargs();
while (paramPos < paramCount && string[stringPos])
{
switch (format[formatPos++])
{
case '\0':
{
return 0;
}
case 'i', 'd':
{
new
neg = 1,
num = 0,
ch = string[stringPos];
if (ch == '-')
{
neg = -1;
ch = string[++stringPos];
}
do
{
stringPos++;
if (ch >= '0' && ch <= '9')
{
num = (num * 10) + (ch - '0');
}
else
{
return 1;
}
}
while ((ch = string[stringPos]) && ch != ' ');
setarg(paramPos, 0, num * neg);
}
case 'h', 'x':
{
new
ch,
num = 0;
while ((ch = string[stringPos++]))
{
switch (ch)
{
case 'x', 'X':
{
num = 0;
continue;
}
case '0' .. '9':
{
num = (num << 4) | (ch - '0');
}
case 'a' .. 'f':
{
num = (num << 4) | (ch - ('a' - 10));
}
case 'A' .. 'F':
{
num = (num << 4) | (ch - ('A' - 10));
}
case ' ':
{
break;
}
default:
{
return 1;
}
}
}
setarg(paramPos, 0, num);
}
case 'c':
{
setarg(paramPos, 0, string[stringPos++]);
}
case 'f':
{
new tmp[25];
strmid(tmp, string, stringPos, stringPos+sizeof(tmp)-2);
setarg(paramPos, 0, _:floatstr(tmp));
}
case 's', 'z':
{
new
i = 0,
ch;
if (format[formatPos])
{
while ((ch = string[stringPos++]) && ch != ' ')
{
setarg(paramPos, i++, ch);
}
if (!i) return 1;
}
else
{
while ((ch = string[stringPos++]))
{
setarg(paramPos, i++, ch);
}
}
stringPos--;
setarg(paramPos, i, '\0');
}
default:
{
continue;
}
}
while (string[stringPos] && string[stringPos] != ' ')
{
stringPos++;
}
while (string[stringPos] == ' ')
{
stringPos++;
}
paramPos++;
}
while (format[formatPos] == 'z') formatPos++;
return format[formatPos];
}
//---------------------Fin Scanff--------------------
public CountFin(playerid)
{
TogglePlayerControllable(playerid, 1);
TogglePlayerControllable(EDuelo, 1);
return 1;
}
public CountTimer()
{
if(CountDown== 6)
{
GameTextForAll("~r~ conteo!", 1000, 6);
}
CountDown--;
if(CountDown== 0)
{
GameTextForAll("~g~ЎYa!", 1000, 6);
CountDown = -1;
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
}
return ;
}
else
{
new
text[7];
format(text,sizeof(text),"~p~%d",CountDown);
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
}
GameTextForAll(text, 1000, 6);
}
SetTimer("CountTimer", 1000, 0);
return ;
}
pues si pides ayuda quieres que adivinemos el codigo y te digamos la respuesta
y ahi te va a jalar........