/giveweapon command
#1

I need help with this command

I want that if a admin types /giveweapon that he can gives a weapon to a random player.
and also I want as USAGE "USAGE:/Giveweapon [ID] [IDofWeapon] [AMOUNT]"
Just take my code and improve it
Quote:

CMD:giveweapon(playerid, params[])
{
if (!IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, -1, "SERVER: Unknown command.");
}
else if (IsPlayerAdmin(playerid))
{
GivePlayerWeapon(playerid, weaponid, 6000);
}
if (!IsPlayerLoggedIn(playerb))
{
SendClientMessage(playerid, COLOR_WARN, "Invalid player id");
}
if (weapon < 4 || weapon > 41)
{
SendClientMessage(playerid, COLOR_WARN, "Weapons are between id 4 and 41");
}
return 1;
}

Reply
#2

Quote:
Originally Posted by saffierr
Посмотреть сообщение
I need help with this command

I want that if a admin types /giveweapon that he can gives a weapon to a random player.
and also I want as USAGE "USAGE:/Giveweapon [ID] [IDofWeapon] [AMOUNT]"
Just take my code and improve it
Refer back to this thread - https://sampforum.blast.hk/showthread.php?tid=526187
Both Miguel and I showed you how to use sscanf. Try using it yourself here, as we aren't here to do all your commands for you. Try your best to get it to work with sscanf and come back here if you need more help.
Reply
#3

dude I already have sscanf...
Reply
#4

How about this?
PHP код:
CMD:giveweap(playeridparams[])
{
    new 
idweap ammo;
       
    else if (
sscanf(params"udd"idweap ammo))
        
SendClientMessage(playerid, -1"USAGE: /giveweap [ playerid ] [ weaponid ] [ ammo ]");
       
    else if (
id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1"Player Is Not Connected!");
        
       
    else
    {
        
GivePlayerWeapon(id weap ammo)
        
SendClientMessage(playeridCOLOR_GREEN"You Gave A Gun To A Player.");
    }
    return 
1;

and something that you need Please Please
before making a thread just go to ****** and search anything that you want

And don't forget my +REP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)