SA-MP Forums Archive
Toggle god on/off - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Toggle god on/off (/showthread.php?tid=490345)



Toggle god on/off - rakshith122 - 26.01.2014

Well, This is my god command. Now, It turns on when I use /vgod, What I need now is, When a player types /vgod again, It should be turned off.
pawn Код:
dcmd_vgod(playerid,params[])
{
    #pragma unused params
    if(IsSpawned[playerid] != 1)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to go into god mode.");
        return 1;
    }
    for(new w=0; w<13; w++)
    {
        GetPlayerWeaponData(playerid,w,PlayerWeapon[playerid][w],PlayerAmmo[playerid][w]);
    }
    SendClientMessage(playerid,COLOR_VIOLETBLUE,"You are now in god mode. You now have infinite health, armour and VIP Weapons.");
    ResetPlayerWeapons(playerid);
    InVIPMode[playerid] =1;

    GivePlayerWeapon(playerid,24,999999);
    GivePlayerWeapon(playerid,26,999999);
    GivePlayerWeapon(playerid,29,999999);
    GivePlayerWeapon(playerid,31,999999);
    SetPlayerHealth(playerid,999999);
    SetPlayerArmour(playerid,999999);
             return 1;
}
Thanks in advance.


Re: Toggle god on/off - Vanter - 26.01.2014

pawn Код:
dcmd_vgod(playerid,params[])
{
    #pragma unused params
    if(IsSpawned[playerid] != 1)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to go into god mode.");
        return 1;
    }
    for(new w=0; w<13; w++)
    {
        GetPlayerWeaponData(playerid,w,PlayerWeapon[playerid][w],PlayerAmmo[playerid][w]);
    }
    if(InVIPMode[playerid] == 0)
{
    SendClientMessage(playerid,COLOR_VIOLETBLUE,"You are now in god mode. You now have infinite health, armour and VIP Weapons.");
    ResetPlayerWeapons(playerid);
    InVIPMode[playerid] =1;

    GivePlayerWeapon(playerid,24,999999);
    GivePlayerWeapon(playerid,26,999999);
    GivePlayerWeapon(playerid,29,999999);
    GivePlayerWeapon(playerid,31,999999);
    SetPlayerHealth(playerid,999999);
    SetPlayerArmour(playerid,999999);
}
     if(InVIPMode[playerid] == 1)
{
         SendClientMessage(playerid, COLOR_GREEN,"You are no longer in God mode.");
         SetPlayerHealth(playerid, 100);
         SetPlayerArmour(playerid, 0);
         InVIPMode(playerid] =0;
}
             return 1;
}



Re: Toggle god on/off - rakshith122 - 26.01.2014

You just made some mistakes on that code, Anyways, I fixed them. Thanks.