[Ayuda Spawn Hospital] -
MarkStuff - 10.08.2017
Hola desde hace mucho tiempo estoy creando una GM desde 0 por mi sуlito sin ayuda, soy algo novato o tal vez Mucho novato pero estoy muy empeсado a terminar esta GM, Irй al grano
Quiero poner un lugar de Spawn al morir Osea que me mande al hospital mas cercano Un Ejem:
Si estoy en ls y muero en ls que me enviй al hospital mas cercano
Estuve viendo todo sus comentarios donde muchos dicen que para el novato empiece con una GM TDM pero ami no me gusta estoy trabajando en un proyecto Roleplay y se que todo los Comando van desordenados pero estoy muy muy empeсado en terminar esta GM asн dure 1 aсo, pero la cuestiуn es que estoy creando una GM simple me refiero a que no tenga muchas cosas solo unos pocos trabajos y esas cosas pero de eso no estoy interesado de momento, de momento estoy en el lugar de spawn que ya lo modifique cuando te registras apareces en el lugar que puse
ahora quiero poner un lugar al morir que me enviй al hospital mas cercano
una ayuda de ustedes que son mas avanzados que yo, yo apenas estoy empezando
PD: Disculpa si puse este post en el lugar que no deberia como y les dije soy novato
Re: [Ayuda Spawn Hospital] -
FuNkYTheGreat - 10.08.2017
Aquн estб el cуdigo
Code:
enum hospital_
{
Float:h_X,
Float:h_Y,
Float:h_Z
};
new Hospitals[][hospital_] =
{
{0.0, 0.0, 0.0}, // Cambie estos coods a sus coods de los hospitales
{123.0, 456.0, 789.0},
{500.0, 500.0, 500.0}
};
stock Float:PlayerDistanceToPoint(playerid, Float:_x, Float:_y, Float:_z)
{
new Float:Coo[3];
GetPlayerPos(playerid,Coo[0],Coo[1],Coo[2]);
return floatsqroot(((Coo[0] - _x) * (Coo[0] - _x)) + ((Coo[1] - _y) * (Coo[1] - _y)) + ((Coo[2] - _z) * (Coo[2] - _z)));
}
stock ClosestHospital(playerid)
{
new hospitalid, Float:closest = PlayerDistanceToPoint(playerid, Hospitals[0][h_X], Hospitals[0][h_Y], Hospitals[0][h_Z];
for(new i=1; i<sizeof(Hospitals); i++)
{
if(PlayerDistanceToPoint(playerid, Hospitals[i][h_X], Hospitals[i][h_Y], Hospitals[i][h_Z]) < closest)
{
closest = PlayerDistanceToPoint(playerid, Hospitals[i][h_X], Hospitals[i][h_Y], Hospitals[i][h_Z]);
hospitalid = i;
}
}
return hospitalid;
}
public OnPlayerDeath(playerid, killerid, reason)
{
SetPVarInt(playerid, "Dead", 1);
SetPVarInt(playerid, "Hospital", ClosestHospital(playerid));
}
public OnPlayerSpawn(playerid)
{
if(GetPVarInt(playerid, "Dead"))
{
new hid = GetPVarInt(playerid, "Hospital");
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerPos(playerid, Hospitals[hid][h_X], Hospitals[hid][h_Y], Hospitals[hid][h_Z]);
SetPVarInt(playerid, "Dead", 0);
}
}
Not created by me , its from a guy named w84m3
Translated by ****** translator tool
Re: [Ayuda Spawn Hospital] -
Sting. - 10.08.2017
Posted in the wrong language section but well he's new and we all make mistakes in the beginning. Hope he's problem is solved....
Re: [Ayuda Spawn Hospital] -
MarkStuff - 10.08.2017
Oye cuando quiero compilar me tira Crash xddd
que ago? puse todo bien a la perfecciуn
Re: [Ayuda Spawn Hospital] -
FuNkYTheGreat - 10.08.2017
Trabajando bien para mн en la compilaciуn,
Y tal vez el problema es que usted acaba de poner el cуdigo mismo, poner cуdigo Onplayerspawn en su cуdigo onplayerspawn y onplayerdeath en su onplayerdeath uno, el stock al final,
Enum en el lugar donde ur enum es
Re: [Ayuda Spawn Hospital] -
MarkStuff - 10.08.2017
gamemodes\Base.pwn(50) : error 001: expected token: ",", but found ";"
gamemodes\Base.pwn(145) : error 010: invalid function or declaration
Re: [Ayuda Spawn Hospital] -
FuNkYTheGreat - 10.08.2017
forgot that try the new one [Olvidй que probar el nuevo]
Code:
#define MAX_HOSPITALS 8 [ Los hospitales mбximos que vas a agregar, va a dar la vuelta entre ellos ]
static const Float:hspawns[MAX_HOSPITALS][4] =
{
{2027.77, -1420.52, 15.99, 137.0},
{1180.85, -1325.57, 12.58, 271.4},
{1244.437, 331.2261, 18.5547, 7.5465},
{-2199.719, -2308.075, 29.6181, 322.8928},
{-2670.285, 616.4364, 13.4531, 183.1042},
{-316.3832, 1056.045, 18.7344, 1.6017},
{-1514.823, 2527.119, 54.7443, 2.3546},
{1578.446, 1770.682, 9.8358, 99.7567}
};
and in onplayerdeath [ Poner esto en la muerte de un jugador ]
Code:
new Float:distance = 99999.0,
Float:tmp_distance,
closest = -1;
for(new i = 0; i < MAX_HOSPITALS; i++)
{
tmp_distance = GetPlayerDistanceFromPoint(playerid, hspawnsr[i][0], hspawns[i][1], hspawns[i][2]);
if (tmp_distance < distance)
{
distance = tmp_distance;
closest = i;
}
}
SetSpawnInfo(playerid, NO_TEAM, GetPlayerSkin(playerid), hspawns[closest][0],hspawns[closest][1],hspawns[closest][2],hspawns[closest][3], 0, 0, 0, 0, 0, 0);
And mate please PM me next time , as its a English section,