Toggle god on/off
#1

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.
Reply
#2

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;
}
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)