SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 25/09/2013, 07:20 PM   #1
MAFIAWARS
Huge Clucker
 
Join Date: Aug 2013
Posts: 266
Reputation: -14
Default How to give weapons to All with one CMD?

Can any one give me that Command so I can give players Weapons in just One Command ?
Like it:

/giveweapon <playerid> <weaponid> <ammo>

And Also /setskin Command to Set the Player Skin like that:

/setskin <playerid> <skinid>

Thanks in Advance.
MAFIAWARS is offline   Reply With Quote
Old 25/09/2013, 07:28 PM   #2
DanishHaq
High-roller
 
Join Date: Sep 2011
Location: Manchester, England, United Kingdom
Posts: 1,352
Reputation: 134
Default Re: How to give weapons to All with one CMD?

pawn Code:
CMD:giveweapon(playerid, params[])
{
    if(pInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid, COLOR_WHITE, "Invalid admin level.");
    new giveplayerid, weaponid, ammo;
    if(sscanf(params, "udd", giveplayerid, weaponid, ammo)) return SendClientMessage(playerid, COLOR_WHITE, "Correct usage: /giveweapon [playerid/name] [weaponid] [ammo]");
    if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_WHITE, "Invalid player ID");
    GivePlayerWeapon(giveplayerid, weaponid, ammo);
    return 1;
}

CMD:setskin(playerid, params[], help)
{
    if(pInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid, COLOR_WHITE, "Invalid admin level.");
    new giveplayerid, skinid;
    if(sscanf(params, "ud", giveplayerid, skinid)) return SendClientMessage(playerid, COLOR_WHITE, "Correct usage: /setskin [playerid/name] [skinid]");
    if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_WHITE, "Invalid player ID");
    SetPlayerSkin(giveplayerid, skinid);
    return 1;
}

ZCMD & sscanf
DanishHaq is offline   Reply With Quote
Old 26/09/2013, 07:25 AM   #3
MAFIAWARS
Huge Clucker
 
Join Date: Aug 2013
Posts: 266
Reputation: -14
Default Re: How to give weapons to All with one CMD?

Thanks Man !

But When I setskin of some player his running or moving style change while he has weapons, why??

And Also tell me How to Give weapons to All with just one Command, like /giveweapontoall <weaponid> <ammo>
MAFIAWARS is offline   Reply With Quote
Old 26/09/2013, 08:04 AM   #4
MAFIAWARS
Huge Clucker
 
Join Date: Aug 2013
Posts: 266
Reputation: -14
Default Re: How to give weapons to All with one CMD?

Made /disarm Command Successfully.
But, I wrote SendClientMessage to targetid...

pawn Code:
SendClientMessage(targetid, COLOR_RED1, "%d has reseted your Weapons !");

It is working Fine But Not Showing Admin Name But showing Numbers lol.

MAFIAWARS is offline   Reply With Quote
Old 26/09/2013, 08:10 AM   #5
SAMProductions
Huge Clucker
 
SAMProductions's Avatar
 
Join Date: Aug 2013
Location: /System32/
Posts: 413
Reputation: 27
Default Re: How to give weapons to All with one CMD?

Try This One:

pawn Code:
new playerName[24];
new string[128];
GetPlayerName(playerid, playerName, sizeof(playerName));
format(string, sizeof(string), "%s (ID: %d) has reseted your Weapons !", playerName, playerid);
SendClientMessage(targetid, COLOR_RED1, string);

or

pawn Code:
SendClientMessage(playerid, COLOR_RED1, "%s has reseted your Weapons !")

Anyways,

%d is "Inserts an integer (whole) number"

so use, %s

%s is Inserts a string.
SAMProductions is offline   Reply With Quote
Old 26/09/2013, 08:16 AM   #6
iZN
High-roller
 
Join Date: Jun 2010
Posts: 2,373
Reputation: 569
Default Re: How to give weapons to All with one CMD?

Let me correct you abit. %d specifier is for decimal values. %i is for integer. Use format to use specifier, it will work like this:
pawn Code:
new PlayerName[24], str_[128];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(str_, sizeof(str_), "%s(%i) has reseted your weapons!", PlayerName, playerid);
SendClientMessage(targetid, COLOR_RED1, str_);
__________________
iZN is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Give player weapons from name Snowman12 Scripting Help 6 14/01/2012 01:46 AM
A command to Give weapons? M.A Help Archive 3 14/08/2010 06:07 PM
problem: give player weapons via if() master2die Help Archive 5 01/05/2010 07:18 AM
Give weapons when you tele? Quest123 Help Archive 1 30/10/2009 10:43 AM
Command To Give Weapons Dmac_91 Help Archive 4 27/05/2009 08:19 AM


All times are GMT. The time now is 01:20 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.