2 little questions about give weapon [HELP]
#1

Hey,

I have 2 little questions,

I have a lot of commands to give everyone ingame an weapon. Its not /giveallweapon <id> <ammo> but /minigunall /rocketall to give everyone a rocket or minigun. But I have created it for all weapons. So I've a lot of commands but it didnt have a check if a player is in a minigame, race or in punishment. So how can I make a check that players in a minigame,race or punishment not get an weapon?

hope anyone knows it.

Quistion number 2;

When I've do as example /rocketall ingame, everyone gets an rocket, but how can I make an command that will remove ALL the given weapons to players? I dont know how to fix an command just likes this: /removeallgivenweapons
That cmd will remove all given weapons away. But how can I make that command?

I hope anyone can help me out!

Thanks
Reply
#2

Question 1: You must to make variables that check if you are in minigame, race, etc.
Example:

pawn Код:
new IsInMinigame[MAX_PLAYERS];

public OnPlayerConnect(playerid);
{
    IsInMinigame[playerid] = 0;
    return 1;
}

CMD:givegunall(playerid, params[])
{
    new targetid;
    if(IsInMinigame[targetid] == 1) return SendClientMessage(targetid, -1, "Your are inside minigame and don't resive weapon from an admin!");
    // Your command
    return 1;
}
Question 2: Show us your command and we will make anti command to remove weapons
Reply
#3

Yes for sure,

Here is one of my cmd that will give everyone a uzi:

pawn Код:
CMD:uziall(playerid, params[])
{
    new str[128];
    if(PlayerAcc[playerid][Log] == 0) return SendClientMessage(playerid, COLOR_ORANGE, "** You are not logged in, please login first.");
    if(PlayerAcc[playerid][Admin] == 0) return SendClientMessage(playerid, -1,""orange"** Sorry, only admins level 4+ can do that command.");
    if(PlayerAcc[playerid][Admin] >= 4)
    {
        if(sscanf(params, "u")) return SendClientMessage(playerid, COLOR_ORANGE, "** You must be type /uziall");

        GivePlayerWeapon(playerid, 28, 9000);
        format(str, sizeof(str), "~y~Uzi ~r~kill ~y~time!");
        GameTextForAll(str, 4000, 3);
        PlayerPlaySound(id,1057,0.0,0.0,0.0);
        foreach(Player, i)
        {
            if(IsPlayerConnected(i) && (i != playerid) && (PlayerAcc[playerid][Admin] < PlayerAcc[i][Admin]))
            {
                GivePlayerWeapon(playerid, 28, 9000);
            }
        }
        format(str, sizeof(str), "** Admin %s(ID:%d) gave everyone a uzi.", GetName(playerid), playerid);
        SendClientMessageToAll(COLOR_YELLOW, str);
        format(str, sizeof(str), "** You gave everyone a uzi.");
        SendClientMessage(playerid, COLOR_YELLOW, str);
    }
    else return ErrorMessages(playerid, 5);
    return 1;
}
Reply
#4

You want to remove all weapons or only for /removeuziall
Reply
#5

for all weapons man
Reply
#6

pawn Код:
CMD:removeallgivenweapons(playerid, params[])
{
    new str[128];
    if(PlayerAcc[playerid][Log] == 0) return SendClientMessage(playerid, COLOR_ORANGE, "** You are not logged in, please login first.");
    if(PlayerAcc[playerid][Admin] == 0) return SendClientMessage(playerid, -1,""orange"** Sorry, only admins level 4+ can do that command.");
    if(PlayerAcc[playerid][Admin] >= 4)
    {
        ResetPlayerWeapons(playerid);
        foreach(Player, i)
        {
            if(IsPlayerConnected(i) && (i != playerid) && (PlayerAcc[playerid][Admin] < PlayerAcc[i][Admin]))
            {
                ResetPlayerWeapons(i);
            }
        }
        format(str, sizeof(str), "** Admin %s(ID:%d) remove all player weapons.", GetName(playerid), playerid);
        SendClientMessageToAll(COLOR_YELLOW, str);
    }
    else return ErrorMessages(playerid, 5);
    return 1;
}
Here you are

PS: Edited
Reply
#7

Thank you very much for your help! Plus rep for you man!

PS: The command /uzi is only given my an uzi whats wrong?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)