Guys im new in pawn, and i made this cmd but i want then when i give a weapon to anyone say what name of the weapon i gave to any player, of course just to me the admin
PHP код:
new gunname[32];
GetWeaponName(gun, gunname, sizeof(gunname));
format(string, sizeof(string), "You have given gun %s (ID: %d) to %s!", gunname, gun, GetName(target));
SendClientMessage(playerid, COLOR_WHITE, string);
PHP код:
CMD:givegun(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 3)
{
new target, gun, string[128];
if(sscanf(params, "ud", target, gun))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givegun [PlayerID] [Weapon ID]");
SendClientMessage(playerid, COLOR_GREEN,"|__________________| Weapon Menu |__________________|");
SendClientMessage(playerid, COLOR_WHITE, "1: Brass Knuckles 2: Golf Club 3: Nite Stick 4: Knife 5: Baseball Bat 6: Shovel 7: Pool Cue 8: Katana 9: Chainsaw");
SendClientMessage(playerid, COLOR_WHITE, "10: Purple Dildo 11: Small White Vibrator 12: Large White Vibrator 13: Silver Vibrator 14: Flowers 15: Cane 16: Frag Grenade");
SendClientMessage(playerid, COLOR_WHITE, "17: Tear Gas 18: Molotov Cocktail 19: Vehicle Missile 20: Hydra Flare 21: Jetpack 22: 9mm 23: Silenced 9mm 24: Deagle 25: Shotgun");
SendClientMessage(playerid, COLOR_WHITE, "26: Sawnoff Shotgun 27: Combat Shotgun 28: Micro SMG (Mac 10) 29: SMG (MP5) 30: AK-47 31: M4 32: Tec9 33: Country Rifle");
SendClientMessage(playerid, COLOR_WHITE, "34: Sniper Rifle 35: Rocket Launcher 36: HS Rocket Launcher 37: Flamethrower 38: Minigun 39: Satchel Charge");
SendClientMessage(playerid, COLOR_WHITE, "40: Detonator 41: Spraycan 42: Fire Extinguisher 43: Camera 44: Nightvision Goggles 45: Infared Goggles 46: Parachute");
SendClientMessage(playerid, COLOR_GREEN,"_____________________________________________________");
return 1;
}
if(gun < 1 || gun > 46) { SendClientMessage(playerid, COLOR_WHITE, "Don't go below 1 or above 47."); return 1; }
if(IsPlayerConnected(target))
{
if(target != INVALID_PLAYER_ID)
{
if(gun == 21)
{
SetPlayerSpecialAction(target, SPECIAL_ACTION_USEJETPACK);
}
GivePlayerWeapon(target, gun, 99999);
new gunname[32];
GetWeaponName(gun, gunname, sizeof(gunname));
format(string, sizeof(string), "You have given gun %s (ID: %d) to %s!", gunname, gun, GetName(target));
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You are not authorized to use that command!");
return 1;
}
return 1;
}