SA-MP Forums Archive
[Ajuda] Godmode off deixa o carro indestrutivel - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Godmode off deixa o carro indestrutivel (/showthread.php?tid=487709)



Godmode off deixa o carro indestrutivel - GuiihCamargo - 14.01.2014

Galera, eu com a ajuda dos parceiros do forum fizemos um comando pra deixar o carro indestrutivel quando digitasse /god, porem, quando digita novamente que o GODMODE fica OFF, o carro ainda fica indestrutivel, segue o comando:

pawn Код:
CMD:god(playerid, params[])
{
    if(PlayerInMiniGame[playerid] != MINIGAME_NONE) return SendClientMessage(playerid, 0xFF4500FF, "Estб em um minijogo, use /sair");
    if(IsPlayerInRace) return SendClientMessage(playerid, 0xFF4500FF, "Estб em uma corrida, use /exitrace");
    if(PlayerInfo[playerid][pGodMode] == 0)
    {
        SetTimerEx("VehicleGod", 1000, true, "i", playerid);
        PlayerInfo[playerid][pGodMode] = 1;
        ResetPlayerWeapons(playerid);
        SetPlayerHealth(playerid, 9999999);
        godMode[playerid] = Create3DTextLabel("God Mode ON!", 0x008080FF, 30.0, 40.0, 50.0, 10.0, 0);
        GameTextForPlayer(playerid, "~g~godmode~n~~y~on", 2000, 5);
        Attach3DTextLabelToPlayer(godMode[playerid], playerid, 0.0, 0.0, 0.7);
    }
    else
    {
        SetVehicleHealth(GetPlayerVehicleID(playerid),100.0);
        PlayerInfo[playerid][pGodMode] = 0;
        SetPlayerHealth(playerid, 100.0);
        GameTextForPlayer(playerid, "~r~godmode~n~~y~off", 2000, 5);
        Delete3DTextLabel(godMode[playerid]);
    }
    return 1;
}
pawn Код:
public VehicleGod(playerid)
{
    if (IsPlayerInAnyVehicle(playerid) == 1)
    {
    SetVehicleHealth(GetPlayerVehicleID(playerid),999999);
    RepairVehicle(GetPlayerVehicleID(playerid));
    }
}



Respuesta: Godmode off deixa o carro indestrutivel - TorresPutado - 14.01.2014

Quote:
Originally Posted by GuiihCamargo
Посмотреть сообщение
Galera, eu com a ajuda dos parceiros do forum fizemos um comando pra deixar o carro indestrutivel quando digitasse /god, porem, quando digita novamente que o GODMODE fica OFF, o carro ainda fica indestrutivel, segue o comando:

pawn Код:
new GodCar[MAX_PLAYERS];
pawn Код:
CMD:god(playerid, params[])
{
    if(PlayerInMiniGame[playerid] != MINIGAME_NONE) return SendClientMessage(playerid, 0xFF4500FF, "Estб em um minijogo, use /sair");
    if(IsPlayerInRace) return SendClientMessage(playerid, 0xFF4500FF, "Estб em uma corrida, use /exitrace");
    if(PlayerInfo[playerid][pGodMode] == 0)
    {
        SetTimerEx("VehicleGod", 1000, true, "i", playerid);
        PlayerInfo[playerid][pGodMode] = 1;
        ResetPlayerWeapons(playerid);
        SetPlayerHealth(playerid, 9999999);
        godMode[playerid] = Create3DTextLabel("God Mode ON!", 0x008080FF, 30.0, 40.0, 50.0, 10.0, 0);
        GameTextForPlayer(playerid, "~g~godmode~n~~y~on", 2000, 5);
        Attach3DTextLabelToPlayer(godMode[playerid], playerid, 0.0, 0.0, 0.7);
    }
    else
    {
        SetVehicleHealth(GetPlayerVehicleID(playerid),100.0);
        PlayerInfo[playerid][pGodMode] = 0;
        SetPlayerHealth(playerid, 100.0);
        GameTextForPlayer(playerid, "~r~godmode~n~~y~off", 2000, 5);
        Delete3DTextLabel(godMode[playerid]);
    }
    return 1;
}
pawn Код:
public VehicleGod(playerid)
{
    if (IsPlayerInAnyVehicle(playerid) == 1)
    {
    SetVehicleHealth(GetPlayerVehicleID(playerid),999999);
    RepairVehicle(GetPlayerVehicleID(playerid));
    }
}
Tenta:

pawn Код:
CMD:god(playerid, params[])
{
    if(PlayerInMiniGame[playerid] != MINIGAME_NONE) return SendClientMessage(playerid, 0xFF4500FF, "Estб em um minijogo, use /sair");
    if(IsPlayerInRace) return SendClientMessage(playerid, 0xFF4500FF, "Estб em uma corrida, use /exitrace");
    if(PlayerInfo[playerid][pGodMode] == 0)
    {
        GodCar[playerid] = 1;
        PlayerInfo[playerid][pGodMode] = 1;
        ResetPlayerWeapons(playerid);
        SetPlayerHealth(playerid, 9999999);
        godMode[playerid] = Create3DTextLabel("God Mode ON!", 0x008080FF, 30.0, 40.0, 50.0, 10.0, 0);
        GameTextForPlayer(playerid, "~g~godmode~n~~y~on", 2000, 5);
        Attach3DTextLabelToPlayer(godMode[playerid], playerid, 0.0, 0.0, 0.7);
    }
    else
    {
        GodCar[playerid] = 0;
        PlayerInfo[playerid][pGodMode] = 0;
        SetPlayerHealth(playerid, 100.0);
        GameTextForPlayer(playerid, "~r~godmode~n~~y~off", 2000, 5);
        Delete3DTextLabel(godMode[playerid]);
    }
    return 1;
}


pawn Код:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{


  if(GodCar[playerid] == 1)
  {
      RepairVehicle(vehicleid);
  }
 
  GameTextForPlayer(playerid,"~r~Voce ~b~Bateu!",1000,1);
 
  return 1;
}
-------
Obs: deixara o servidor menos legado!!

Ajudei +REP

#EDIT
__________________________________________________ _____



Re: Godmode off deixa o carro indestrutivel - PT - 14.01.2014

Quote:
Originally Posted by GuiihCamargo
Посмотреть сообщение
pawn Код:
SetTimerEx("VehicleGod", 1000, true, "i", playerid);
Falta KillTimer ae ne.


Re: Respuesta: Godmode off deixa o carro indestrutivel - GuiihCamargo - 14.01.2014

Pronto, so add mais uma coisinha e ficou ok, [TOPICO RESOLVIDO]

Quem estiver com o mesmo erro:

ADD NO TOPO DO GM
pawn Код:
new GodCar[MAX_PLAYERS];
E MUDA O CMD PRA ESSE:
pawn Код:
CMD:god(playerid, params[])
{
    if(PlayerInMiniGame[playerid] != MINIGAME_NONE) return SendClientMessage(playerid, 0xFF4500FF, "Estб em um minijogo, use /sair");
    if(IsPlayerInRace) return SendClientMessage(playerid, 0xFF4500FF, "Estб em uma corrida, use /exitrace");
    if(PlayerInfo[playerid][pGodMode] == 0)
    {
        GodCar[playerid] = 1;  //LINHA 16781
        PlayerInfo[playerid][pGodMode] = 1;
        ResetPlayerWeapons(playerid);
        SetPlayerHealth(playerid, 9999999);
        godMode[playerid] = Create3DTextLabel("God Mode ON!", 0x008080FF, 30.0, 40.0, 50.0, 10.0, 0);
        GameTextForPlayer(playerid, "~g~godmode~n~~y~on", 2000, 5);
        Attach3DTextLabelToPlayer(godMode[playerid], playerid, 0.0, 0.0, 0.7);
    }
    else
    {
        GodCar[playerid] = 0;
        PlayerInfo[playerid][pGodMode] = 0;
        SetPlayerHealth(playerid, 100.0);
        GameTextForPlayer(playerid, "~r~godmode~n~~y~off", 2000, 5);
        Delete3DTextLabel(godMode[playerid]);
    }
    return 1;
}
+rep para @TorresPutado