How to give weapons to All with one CMD? -
MAFIAWARS - 25.09.2013
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.
Re: How to give weapons to All with one CMD? -
DanishHaq - 25.09.2013
pawn Код:
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
Re: How to give weapons to All with one CMD? -
MAFIAWARS - 26.09.2013
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>
Re: How to give weapons to All with one CMD? -
MAFIAWARS - 26.09.2013
Made /disarm Command Successfully.
But, I wrote SendClientMessage to targetid...
pawn Код:
SendClientMessage(targetid, COLOR_RED1, "%d has reseted your Weapons !");
It is working Fine But Not Showing Admin Name But showing Numbers lol.
Re: How to give weapons to All with one CMD? -
SAMProductions - 26.09.2013
Try This One:
pawn Код:
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 Код:
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.
Re: How to give weapons to All with one CMD? -
iZN - 26.09.2013
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 Код:
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_);