Hola Que Tal,Les traigo un fs de sistema de duelos para Dm. (Map Incluido.)
Código:
Para Que Lo Descargen
Código:
- Spoiler:
- #include <a_samp>
/////////Pragma////////////////
#pragma tabsize 0
/////////Defines///////////////
#define FILTERSCRIPT
#define SendError(%1,%2) SendClientMessage(%1,Rojo,"ERROR: " %2)
#define SendUsage(%1,%2) SendClientMessage(%1,Blanco,"USAGE: " %2)
#define Naranjo 0xFF8040FF
#define Amarillo 0xFFFF00AA
#define Rojo 0xFF0000AA
#define Blanco 0xFFFFFFAA
/////////Stock/////////////////
stock
InvitadoAlDuelo[MAX_PLAYERS],
HasInvitadoAlDuelo[MAX_PLAYERS],
JugadorEnElDuelo[MAX_PLAYERS],
Conteo[MAX_PLAYERS],
DueloTimer[MAX_PLAYERS],
DueloEnProgreso,
DueloID1,
DueloID2;
/////////CallBacks/////////////
public OnFilterScriptInit()
{
print("\t============================================");
print("\tSistema De Duelo");
print("\t-----------------");
print("\t---------------------------------------------");
print("\tCargando......!");
print("\t============================================");
return 1;
}
public OnFilterScriptExit()
{
print("\t============================================");
print("\tSistema De Duelo ");
print("\t/////////////////");
print("\t--------------------------------------------");
print("\tFinalizando.....!");
print("\t============================================");
return 1;
}
public OnGameModeInit()
{
CreateObject(979,1801.65441895,-1935.19567871,13.30465126,0.00000000,0.00000000,0.00000000); //object(sub_roadleft) (1)
CreateObject(979,1792.40161133,-1935.11157227,13.30465126,0.00000000,0.00000000,0.00000000); //object(sub_roadleft) (2)
CreateObject(979,1783.49951172,-1935.07128906,13.30465126,0.00000000,0.00000000,0.00000000); //object(sub_roadleft) (3)
CreateObject(979,1774.79443359,-1934.87768555,13.30465126,0.00000000,0.00000000,0.00000000); //object(sub_roadleft) (4)
CreateObject(979,1772.79882812,-1935.16284180,13.30465126,0.00000000,0.00000000,0.00000000); //object(sub_roadleft) (5)
CreateObject(979,1806.80688477,-1935.30273438,13.30465126,0.00000000,0.00000000,0.00000000); //object(sub_roadleft) (6)
CreateObject(979,1752.41186523,-1907.04370117,13.40516472,0.00000000,0.00000000,0.00000000); //object(sub_roadleft) (7)
CreateObject(986,1810.41113281,-1883.57531738,12.58351231,0.00000000,0.00000000,274.00000000); //object(gate_autol) (1)
CreateObject(986,1810.86206055,-1895.72094727,12.57979965,0.00000000,0.00000000,273.99902344); //object(gate_autol) (2)
CreateObject(986,1810.47338867,-1889.96350098,12.57979965,0.00000000,0.00000000,273.99902344); //object(gate_autol) (3)
CreateObject(16088,1767.59973145,-1894.69030762,12.56262207,0.00000000,0.00000000,2.00000000); //object(des_pipestrut01) (1)
CreateObject(16088,1789.43652344,-1930.67382812,12.38735199,0.00000000,0.00000000,270.00000000); //object(des_pipestrut01) (2)
CreateObject(18257,1809.27478027,-1907.71008301,12.57217407,0.00000000,0.00000000,88.00000000); //object(crates) (1)
CreateObject(18257,1793.25891113,-1882.18176270,12.57094955,0.00000000,0.00000000,179.99499512); //object(crates) (2)
CreateObject(2358,1805.83581543,-1930.06445312,12.50418663,0.00000000,0.00000000,0.00000000); //object(ammo_box_c2) (1)
CreateObject(923,1779.72375488,-1933.75622559,13.26553535,0.00000000,0.00000000,0.00000000); //object(packing_carates2) (1)
CreateObject(3643,1754.62329102,-1889.76391602,18.46166229,0.00000000,0.00000000,6.00000000); //object(la_chem_piping) (1)
CreateObject(1420,1769.24633789,-1924.12207031,15.60645580,0.00000000,0.00000000,94.00000000); //object(dyn_aircon) (1)
CreateObject(3214,1807.57470703,-1885.75439453,21.39905357,0.00000000,0.00000000,358.00000000); //object(quarry_crusher) (1)
CreateObject(9125,1782.61950684,-1924.36523438,12.71239758,0.00000000,0.00000000,270.00000000); //object(lxorneon) (1)
CreateObject(9125,1803.65380859,-1924.48388672,12.71239758,0.00000000,0.00000000,270.00000000); //object(lxorneon) (2)
CreateObject(9125,1760.39550781,-1924.00048828,12.71239758,0.00000000,0.00000000,270.00000000); //object(lxorneon) (3)
CreateObject(7302,1772.74560547,-1883.69543457,23.69544983,0.00000000,0.00000000,14.00000000); //object(vgsn_addboard04) (1)
CreateObject(7391,1754.53698730,-1909.37280273,17.43419838,0.00000000,0.00000000,0.00000000); //object(vgngassign102) (1)
}
public OnPlayerConnect(playerid)
{
InvitadoAlDuelo[playerid] = 0;
HasInvitadoAlDuelo[playerid] = 0;
JugadorEnElDuelo[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(playerid == DueloID1 || playerid == DueloID2)
{
DueloEnProgreso = 0;
}
return 1;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], idx, tmp[256];
cmd = strtok(cmdtext, idx);
if(!strcmp(cmd, "/iduelo", true))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xBFC0C2FF, "Uso: /iduelo [playerid]");
return 1;
}
if(HasInvitadoAlDuelo[playerid] == 1) return SendError(playerid, "Ya Has Invitado a alguien a un duelo!");
new DuelID = strvalEx(tmp), pName[MAX_PLAYER_NAME],zName[MAX_PLAYER_NAME],tString[128];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(DuelID, zName, MAX_PLAYER_NAME);
if (!IsPlayerConnected(DuelID)) return SendError(playerid, "Jugador No Conectado.");
if( HasInvitadoAlDuelo[DuelID] == 1) return SendError(playerid, "Ese jugador es invitado a un duelo!");
if( DuelID == playerid) return SendError(playerid, "No puedes tener un duelo contigo mismo!");
format(tString, sizeof(tString), "Invitaste a %s (ID:%d) a un duelo 1 vs 1, espera que %s acepte la invitacion.",zName, DuelID, zName);
SendClientMessage(playerid, Amarillo, tString);
format(tString, sizeof(tString), "Tu haz sido invitado a un duelo por %s (ID:%d) a un duelo 1 vs 1, tipea /aceptar [ID Del Jugador] para aceptar y empezar el duelo.",pName, playerid);
SendClientMessage(DuelID, Amarillo, tString);
InvitadoAlDuelo[DuelID] = playerid;
HasInvitadoAlDuelo[playerid] = 1;
return 1;
}
if(!strcmp(cmd, "/aceptar", true))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xBFC0C2FF, "Uso: /aceptar [playerid]");
return 1;
}
if(DueloEnProgreso == 1)return SendError(playerid, "Otro Duelo esta en progreso, espera a que ese duelo Termine!");
new DuelID = strvalEx(tmp),pName[MAX_PLAYER_NAME],zName[MAX_PLAYER_NAME],tString[128];
if(DuelID != InvitadoAlDuelo[playerid])return SendError(playerid, "Ese jugador no te invito a un Duelo!");
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(DuelID, zName, MAX_PLAYER_NAME);
format(tString, sizeof(tString), "Tu has aceptado el duelo con %s (ID:%d), El duelo comenzara en 10 segundos..",zName,DuelID);
SendClientMessage(playerid, Amarillo, tString);
format(tString, sizeof(tString), "%s (ID:%d), Acepto el duelo, El duelo comenzara en 10 segundos..",pName,playerid);
SendClientMessage(DuelID, Amarillo, tString);
format(tString, sizeof(tString), "***Informacion: Se inicia un duelo entre %s y %s comenzara en 10 segundos",pName,zName);
SendClientMessageToAll(Naranjo, tString);
InitializeDuel(playerid);
InitializeDuelEx( DuelID);
JugadorEnElDuelo[playerid] = 1;
JugadorEnElDuelo[DuelID] = 1;
DueloID1 = playerid;
DueloID2 = DuelID;
DueloEnProgreso = 1;
return 1;
}
if (strcmp("/cancelar", cmdtext, true, 10) == 0)
{
if(HasInvitadoAlDuelo[playerid] == 0) return SendError(playerid, "Tu no has invitado a nadie a un Duelo!");
SendClientMessage(playerid, Amarillo, "Cancelaste tu invitacion de duelo, Ahora puedes usar /iduelo [ID Del Jugador] de nuevo.");
HasInvitadoAlDuelo[playerid] = 0;
return 1;
}
return 0;
}
forward InitializeDuel(playerid);
public InitializeDuel(playerid)
{
DueloTimer[playerid] = SetTimerEx("DuelCountDown", 1000, 1, "i", playerid);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
SetPlayerPos(playerid, 1785.4281005859,-1932.8078613281,13.035537719727); // da1
//SetPlayerFacingAngle(playerid, A);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 0);
Conteo[playerid] = 11;
SetPlayerVirtualWorld(playerid,1); //Virtual World
return 1;
}
forward InitializeDuelEx(playerid);
public InitializeDuelEx(playerid)
{
DueloTimer[playerid] = SetTimerEx("DuelCountDown", 1000, 1, "i", playerid);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
SetPlayerPos(playerid, 1781.046875,-1897.4927978516,13.039308547974);
//SetPlayerFacingAngle(playerid, A);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 0);
Conteo[playerid] = 11;
SetPlayerVirtualWorld(playerid,1); //Virtual World
return 1;
}
forward DuelCountDown(playerid);
public DuelCountDown(playerid)
{
new
tString[128] ;
Conteo[playerid] --;
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
format(tString, sizeof(tString), "~w~%d", Conteo[playerid]);
GameTextForPlayer(playerid, tString, 900, 3);
if(Conteo[playerid] == 0)
{
KillTimer(DueloTimer[playerid]);
TogglePlayerControllable(playerid, 1);
GameTextForPlayer(playerid,"~g~YA", 900, 3);
return 1;
}
return 1;
}
strvalEx(xxx[])
{
if(strlen(xxx) > 9)
return 0;
return strval(xxx);
}
/*IsNumeric(const string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return false;
}
return true;
}*/
public OnPlayerDeath(playerid, killerid, reason)
{
new
sString[128],
pName[MAX_PLAYER_NAME],
zName[MAX_PLAYER_NAME],
Float:Health,
Float:Armor;
if(JugadorEnElDuelo[playerid] == 1 && JugadorEnElDuelo[killerid] == 1)
{
GetPlayerHealth(killerid, Health);
GetPlayerArmour(killerid, Armor);
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(killerid, zName, MAX_PLAYER_NAME);
if(Health > 90.0 && Armor > 90.0)
{
format(sString, sizeof(sString),"***Informacion: %s Ha\"Ganado\" a %s en el duelo quedo con %.2f de vida y %.2f de blindaje!", zName,pName,Health,Armor);
SendClientMessageToAll(Naranjo, sString);
InvitadoAlDuelo[playerid] = 0;HasInvitadoAlDuelo[playerid] = 0;JugadorEnElDuelo[playerid] = 0;
InvitadoAlDuelo[killerid] = 0;HasInvitadoAlDuelo[killerid] = 0;JugadorEnElDuelo[killerid] = 0;
DueloEnProgreso = 0;
return 1;
}
else
{
format(sString, sizeof(sString),"***Informacion: %s a ganado el duelo contra %s con %.2f de vida y %.2f de blindaje!", zName,pName,Health,Armor);
SendClientMessageToAll(Naranjo, sString);
InvitadoAlDuelo[playerid] = 0;HasInvitadoAlDuelo[playerid] = 0;JugadorEnElDuelo[playerid] = 0;
InvitadoAlDuelo[killerid] = 0;HasInvitadoAlDuelo[killerid] = 0;JugadorEnElDuelo[killerid] = 0;
DueloEnProgreso = 0;
return 1;
}
}
return 1;
}
Para Que Lo Descargen
- Spoiler: