SA-MP Forums Archive
Weapons Remove /god - 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: Weapons Remove /god (/showthread.php?tid=526968)



Weapons Remove /god - Andre02 - 20.07.2014

Hello Sa-Mp Forums.
i have a God Mode command which use rsi/r_health :

pawn Код:
#include <rSI\r_health>

CMD:god(playerid, params[])
{
    if(GodMode[playerid] == 0)
    {
        EnableGod(playerid);
        GodMode[playerid] = 1;
        SendClientMessage(playerid, 0x10F441AA, "You have Enabled your God Mode.");
    }
    else if(GodMode[playerid] == 1)
    {
        DisableGod(playerid);
        GodMode[playerid] = 0;
        SendClientMessage(playerid, 0x10F441AA, "You have Disabled your God Mode.");
        }
    return 1;
}
But the player keep having his/her Weapons

and i want to know how to remove his/her Weapons when he/she use /god but when he/she disable god his/her Weapons should be back with the same ammo and the same weapons.

Thank you


Re: Weapons Remove /god - GeekSiMo - 20.07.2014

What You Will Use :
https://sampwiki.blast.hk/wiki/GetPlayerWeapon
https://sampwiki.blast.hk/wiki/GivePlayerWeapon
https://sampwiki.blast.hk/wiki/ResetPlayerWeapons


Re: Weapons Remove /god - SHE790 - 20.07.2014

try this
pawn Код:
#include <rSI\r_health>

CMD:god(playerid, params[])
{
    if(GodMode[playerid] == 0)
    {
        EnableGod(playerid);
        ResetPlayerWeapons(playerid);
        GodMode[playerid] = 1;
        SendClientMessage(playerid, 0x10F441AA, "You have Enabled your God Mode.");
    }
    else if(GodMode[playerid] == 1)
    {
        DisableGod(playerid);
        GodMode[playerid] = 0;
        SendClientMessage(playerid, 0x10F441AA, "You have Disabled your God Mode.");
        }
    return 1;
}



Re: Weapons Remove /god - GeekSiMo - 20.07.2014

Quote:
Originally Posted by SHE790
Посмотреть сообщение
try this
pawn Код:
#include <rSI\r_health>

CMD:god(playerid, params[])
{
    if(GodMode[playerid] == 0)
    {
        EnableGod(playerid);
        ResetPlayerWeapons(playerid);
        GodMode[playerid] = 1;
        SendClientMessage(playerid, 0x10F441AA, "You have Enabled your God Mode.");
    }
    else if(GodMode[playerid] == 1)
    {
        DisableGod(playerid);
        GodMode[playerid] = 0;
        SendClientMessage(playerid, 0x10F441AA, "You have Disabled your God Mode.");
        }
    return 1;
}
Weapons should be back with the same ammo and the same weapons.


Re: Weapons Remove /god - GShock - 20.07.2014

Try using GetPlayerWeaponData....


pawn Код:
#include <rSI\r_health>

CMD:god(playerid, params[])
{
    new weapons[13][2];
    if(GodMode[playerid] == 0)
    {
        EnableGod(playerid);
        GetPlayerWeaponData(playerid, weapons[i][0], weapons[i][1]);
        GodMode[playerid] = 1;
        ResetPlayerWeapons(playerid);
        SendClientMessage(playerid, 0x10F441AA, "You have Enabled your God Mode.");
    }
    else if(GodMode[playerid] == 1)
    {
        DisableGod(playerid);
        GivePlayerWeapons(playerid, weapons[i][0], weapons[i][1]);
        GodMode[playerid] = 0;
        SendClientMessage(playerid, 0x10F441AA, "You have Disabled your God Mode.");
        }
    return 1;
}
Untested


Re: Weapons Remove /god - GShock - 20.07.2014

oops


Re: Weapons Remove /god - Andre02 - 20.07.2014

i get 2 errors :
pawn Код:
C:\Users\xxx\Desktop\Samp Script\.pwn , .amx\SupremeStuntWorld.pwn(604) : error 017: undefined symbol "i"
C:\Users\xxx\Desktop\Samp Script\.pwn , .amx\SupremeStuntWorld.pwn(612) : error 017: undefined symbol "i"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
using your pawn code GShock


Re: Weapons Remove /god - GShock - 20.07.2014

pawn Код:
#include <rSI\r_health>
new weapons[13][2];
CMD:god(playerid, params[])
{
    new weapons[13][2];
    if(GodMode[playerid] == 0)
    {
        EnableGod(playerid);
        for (new i = 0; i <= 12; i++)
        {
            GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
        }
        GodMode[playerid] = 1;
        ResetPlayerWeapons(playerid);
        SendClientMessage(playerid, 0x10F441AA, "You have Enabled your God Mode.");
    }
    else if(GodMode[playerid] == 1)
    {
        DisableGod(playerid);
        GodMode[playerid] = 0;
        SendClientMessage(playerid, 0x10F441AA, "You have Disabled your God Mode.");
        for (new i = 0; i <= 12; i++)
        {
                GivePlayerWeapon(playerid, weapons[i][0], weapons[i][1]);
        }
        }
    return 1;
}



Re: Weapons Remove /god - Andre02 - 21.07.2014

i dont get the weapons back :/


Re: Weapons Remove /god - GShock - 22.07.2014

It worked for me :/