if(PlayerInfo[playerid][pMember] == 1 || GetPlayerSkin(playerid) ==5 || GetPlayerSkin(playerid) ==3) { SetPlayerPos(playerid,0.0,0.0,3.0); return 0; } |
if(PlayerInfo[playerid][pMember] == 1 && GetPlayerSkin(playerid) == 5 || GetPlayerSkin(playerid) == 3)
//Chekea si tiene la variable pMember igual a 1 y el skins 5 o 3
{
//aca Tu Funcion
}
else
{
//aca Tu mensaje al no acceder a la funcion
return 1;
}
public oxigeno(playerid) { new oxigeno = GetPlayerAltitude(playerid); if(oxigeno > 700) { if(PlayerInfo[playerid][pMember] == 1 && GetPlayerSkin(playerid) == 5 || GetPlayerSkin(playerid) == 3) { SetTimer("oxigeno", 10000, 0); SetPlayerHealth(playerid, 0); SendClientMessage(playerid, COLOR_GREEN, "Te estas ahogando, ponte un traje espacial!"); } else { SendClientMessage(playerid, COLOR_GREEN, "oxigeno!"); return 1; }
forward oxigeno();
Estoy haciendo un sistema que al subir una altitud te quite la salud en X segundos como simulando ser la falta de oxigeno si no llevas X skin, pero no me compila bien, te dejo lo que he echo:
Код:
public oxigeno(playerid) { new oxigeno = GetPlayerAltitude(playerid); if(oxigeno > 700) { if(PlayerInfo[playerid][pMember] == 1 && GetPlayerSkin(playerid) == 5 || GetPlayerSkin(playerid) == 3) { SetTimer("oxigeno", 10000, 0); SetPlayerHealth(playerid, 0); SendClientMessage(playerid, COLOR_GREEN, "Te estas ahogando, ponte un traje espacial!"); } else { SendClientMessage(playerid, COLOR_GREEN, "oxigeno!"); return 1; } Код:
forward oxigeno(); ![]() -PD: Cual es el problema? |
public oxigeno(playerid)
{
new oxigeno = GetPlayerAltitude(playerid);
if(oxigeno > 700)
{
if(PlayerInfo[playerid][pMember] == 1 && GetPlayerSkin(playerid) == 5 || GetPlayerSkin(playerid) == 3)
{
SetTimer("oxigeno", 10000, 0);
SetPlayerHealth(playerid, 0);
SendClientMessage(playerid, COLOR_GREEN, "Te estas ahogando, ponte un traje espacial!");
}
else
{
SendClientMessage(playerid, COLOR_GREEN, "oxigeno!");
}
}
return 1;
}
Gracias grove
![]() EDIT: Parece que no funciona, al subir los 700 de altitud no pasa nada, creo que se tiene que poner en onplayerupdate pero al haber el public oxigeno no me dejara, se te ocurre alguna soluciуn? |
public oxigeno(playerid)
{
new oxigeno = GetPlayerAltitude(playerid);
if(oxigeno > 700)
{
if(PlayerInfo[playerid][pMember] == 1 && GetPlayerSkin(playerid) == 5 || GetPlayerSkin(playerid) == 3)
{
SetPlayerHealth(playerid, 0);
SendClientMessage(playerid, COLOR_GREEN, "Te estas ahogando, ponte un traje espacial!");
}
else
{
SendClientMessage(playerid, COLOR_GREEN, "oxigeno!");
}
}
return 1;
}
SetTimer("oxigeno", 1000, true); //En OnGameModeInit
forward oxigeno();
public oxigeno()
{
new altitud;
new Float:salud__;
for(new i=0,j=GetMaxPlayers(); i < j; i++) if(IsPlayerConnected(i) && !IsPlayerNPC(i)) {
altitud = GetPlayerAltitude(i);
if(altitud > 700)
{
if(PlayerInfo[i][pMember] == 1 && (GetPlayerSkin(i) == 5 || GetPlayerSkin(i) == 3))
{
SendClientMessage(i, COLOR_GREEN, "oxigeno!");
}
else
{
GetPlayerHealth(i,salud__);
if(salud__ < 5) {
SetPlayerHealth(i,0.00);
}
else {
SetPlayerHealth(i, -5.00);
}
SendClientMessage(i, COLOR_GREEN, "Te estas ahogando, ponte un traje espacial!");
}
}
}
}
Estoy haciendo un sistema que al subir una altitud te quite la salud en X segundos como simulando ser la falta de oxigeno si no llevas X skin, pero no me compila bien, te dejo lo que he echo:
|
//con este te quitarб vida si llevas cualquiera de los dos skins
if(PlayerInfo[i][pMember] == 1 && !(GetPlayerSkin(i) == 5 || GetPlayerSkin(i) == 3))