GivePlayerWeapon (id) (weaponid) (ammo) -
Youtube12 - 03.03.2013
Hi guys, who can help me to do "/giveplayerweapon" command using dcmd?
Re: GivePlayerWeapon (id) (weaponid) (ammo) -
Noles2197 - 03.03.2013
Try this:
pawn Код:
dcmd_giveweapon(playerid, params[]){
new weapon,ammo;
if(sscanf(params,"ii",weapon,ammo)) return SendClientMessage(playerid,COLOR_GRAY,"USAGE: /giveweapon [weapon] [ammo]");
GivePlayerWeapon(playerid, weapon, ammo);
return 1;
}
List of weapon IDs:
https://sampwiki.blast.hk/wiki/Weapons
AW: GivePlayerWeapon (id) (weaponid) (ammo) -
Youtube12 - 03.03.2013
And what should i put under OnPlayerCommandText?
dcmd(giveweapon....??
Re: AW: GivePlayerWeapon (id) (weaponid) (ammo) -
Noles2197 - 03.03.2013
Quote:
Originally Posted by *******12
And what should i put under OnPlayerCommandText?
dcmd(giveweapon....??
|
Put the code I posted somewhere in your script and when they do /giveweapon along with the weapon ID and ammo, it should give it to them.
Also, I used sscanf:
https://sampforum.blast.hk/showthread.php?tid=120356
If you don't have this already, download that & put this at the top of your script:
Re: AW: GivePlayerWeapon (id) (weaponid) (ammo) -
Jstylezzz - 03.03.2013
Quote:
Originally Posted by *******12
And what should i put under OnPlayerCommandText?
dcmd(giveweapon....??
|
Use the thing noles gave you, and put this under OnPlayerCommandText:
pawn Код:
dcmd(giveplayerweapon, 6, cmdtext);
Something like this.
I recommend you to use ZCMD, since it's a little easier.
and btw, you shouldn't make multiple threads about the same subject, just edit your last post with the message 'I want to use dcmd instead of strcmp'
AW: GivePlayerWeapon (id) (weaponid) (ammo) -
Youtube12 - 03.03.2013
Not work, when i write /giveweapon,
Server unknown command
Re: GivePlayerWeapon (id) (weaponid) (ammo) -
erminpr0 - 03.03.2013
pawn Код:
dcmd(giveplayerweapon, 16, cmdtext);
count..
WHYYYYYY DCMDDDDDDD :OOOOOOOOOOOOOOOO
YCMD is the best cmd processor, you're using methods from second world war -.-
I couldn't sleep if I use dcmd or strcmp :O
Re: GivePlayerWeapon (id) (weaponid) (ammo) -
DerickClark - 03.03.2013
work good with zcmds.
Re: GivePlayerWeapon (id) (weaponid) (ammo) -
LarzI - 03.03.2013
ZCMD and YCMD are far more superior than DCMD and even easier as you don't have to do anything with OnPlayerCommandText - I recommend looking both up and chose the one you like the best.
Re: GivePlayerWeapon (id) (weaponid) (ammo) -
erminpr0 - 03.03.2013
look
pawn Код:
YCMD:giveplayergun(playerid, params[], help)
{
#pragma unused help
new ammo, playa, playaname[MAX_PLAYER_NAME], admin[MAX_PLAYER_NAME], gun, string[128];
if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, -1, "You are not allowed to use that command!");
else if(sscanf(params, "uii", playa, gun))
return SendClientMessage(playerid, -1, "CORRECT USAGE: /giveplayergun [playerid] [gun id] [ammo]");
else if(playa == INVALID_PLAYER_ID))
return SendClientMessage(playerid, -1, "ERROR: That player is not active");
GivePlayerWeapon(playa, gun, ammo);
GetPlayerName(playerid, admin, sizeof(admin));
GetPlayerName(playa, playaname, sizeof(playaname));
format(string, sizeof(string), "Admin %s gave you weapon ID %i", admin, gun);
SendClientMessage(playa, -1, string);
format(string, sizeof(string), "You gave gun (ID:%i) to %s(%d)", gun, playaname, playa);
SendClientMessage(playerid, -1, string);
return 1;
}
see