new ammo = GetPlayerAmmo(playerid);
new playergun = GetPlayerWeapon(playerid);
GivePlayerWeapon(playerid, playergun, -ammo);
GivePlayerWeapon(THE_OTHER_PLAYER_ID, playergun, ammo);
if(strcmp(cmd, "/givegun", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /givegun [playerid/PartOfName] [weaponid(eg. 46 = Parachute)] [ammo]"); return 1; } new playa; new gun; new ammo; playa = ReturnUser(tmp); tmp = strtok(cmdtext, idx); gun = strval(tmp); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /givegun [playerid/PartOfName] [weaponid] [ammo]"); SendClientMessage(playerid, COLOR_GRAD4, "3(Police Baton) 4(knife) 5(bat) 6(Shovel) 7(Cue) 8(Katana) 10-13(Dildo) 14(Flowers) 16(Grenades) 18(Molotovs) 22(Pistol) 23(SPistol)"); SendClientMessage(playerid, COLOR_GRAD3, "24(Eagle) 25(shotgun) 29(MP5) 30(AK47) 31(M4) 32(TEC-9) 33(Rifle) 34(Sniper) 37(Flamethrower) 38(Minigun) 41(spray) 42(exting) 43(Camera) 46(Parachute)"); return 1; } if(gun < 1||gun > 46||gun==27||gun==1||gun==2||gun==9||gun==17||gun==19||gun==20||gun==21||gun==36||gun==39||gun==40||gun==44||gun==45) { SendClientMessage(playerid, COLOR_RED, " wrong WeaponID!"); return 1; } tmp = strtok(cmdtext, idx); ammo = strval(tmp); if(ammo <1||ammo > 999) { SendClientMessage(playerid, COLOR_GRAD1, " dont go below 1 or above 999 bullets!"); return 1; } if (PlayerInfo[playerid][pAdmin] >= 4) { if(IsPlayerConnected(playa)) { if(playa != INVALID_PLAYER_ID) { GivePlayerWeapon(playa, gun, ammo); } } } else { SendClientMessage(playerid, COLOR_RED, " you are not authorized to use that command!"); } } return 1; }
if(strcmp(cmd,"/givegun",true)==0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, _COLOR_WHITE, "Usage: /givegun [ID]");
return 1;
}
giveplayerid = strval(tmp);
if(IsPlayerConnected(giveplayerid))
{
new weaponname[30];
new ammo = GetPlayerAmmo(playerid);
new weapon = GetPlayerWeapon(playerid);
if(weapon == 0){format(weaponname,sizeof(weaponname),"Unarmed (Fist)"); ammo = 0;}
else if(weapon == 1){format(weaponname,sizeof(weaponname),"Brass Knuckles"); ammo = 0;}
else if(weapon == 2){format(weaponname,sizeof(weaponname),"Golf Club"); ammo = 0;}
else if(weapon == 3){format(weaponname,sizeof(weaponname),"Nite Stick"); ammo = 0;}
else if(weapon == 4){format(weaponname,sizeof(weaponname),"Knife"); ammo = 0;}
else if(weapon == 5){format(weaponname,sizeof(weaponname),"Baseball Bat"); ammo = 0;}
else if(weapon == 6){format(weaponname,sizeof(weaponname),"Shovel"); ammo = 0;}
else if(weapon == 7){format(weaponname,sizeof(weaponname),"Pool Cue"); ammo = 0;}
else if(weapon == 8){format(weaponname,sizeof(weaponname),"Katana"); ammo = 0;}
else if(weapon == 9){format(weaponname,sizeof(weaponname),"Chainsaw"); ammo = 0;}
else if(weapon == 10){format(weaponname,sizeof(weaponname),"Purple Dildo"); ammo = 0;}
else if(weapon == 11){format(weaponname,sizeof(weaponname),"Small White Vibrator"); ammo = 0;}
else if(weapon == 12){format(weaponname,sizeof(weaponname),"Large White Vibrator"); ammo = 0;}
else if(weapon == 13){format(weaponname,sizeof(weaponname),"Silver Vibrator"); ammo = 0;}
else if(weapon == 14){format(weaponname,sizeof(weaponname),"Flowers"); ammo = 0;}
else if(weapon == 15){format(weaponname,sizeof(weaponname),"Cane"); ammo = 0;}
else if(weapon == 18){format(weaponname,sizeof(weaponname),"Molotov Cocktail"); ammo = GetPlayerAmmo(playerid);}
else if(weapon == 44){format(weaponname,sizeof(weaponname),"Nightvision Goggles"); ammo = 0;}
else if(weapon == 45){format(weaponname,sizeof(weaponname),"Thermal Goggles"); ammo = 0;}
else
{
GetWeaponName(weapon, weaponname, sizeof(weaponname));
}
GivePlayerWeapon(playerid,weapon,-ammo);
GivePlayerWeapon(playerid,weapon,ammo);
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string,sizeof(string),"You give %s the weapon \"%s\" with %d ammo.",giveplayer, weaponname, ammo);
SendClientMessage(playerid,_COLOR_YELLOW,string);
format(string,sizeof(string),"You got from %s the weapon \"%s\" with %d ammo.",playername, weaponname, ammo);
SendClientMessage(playerid,_COLOR_YELLOW,string);
}
else
{
SendClientMessage(playerid, _COLOR_WHITE, "This ID doesn't exists.");
return 1;
}
return 1;
}
Originally Posted by Headshot1108
I've created this:
pawn Код:
Everyone can use it, if you like. |