CMD:sammo(playerid, params[])
{
if(pInfo[playerid][Logged] == 0) return SCM(playerid,0x0080C0FF,"Please login before using this command.");
if(pInfo[playerid][Jailed] == 1) return SCM(playerid,0xFF0000FF,"You can't use this command in jail.");
if(pSpawned[playerid] == 0) return SCM(playerid, COLOR_LIGHTBLUE, "Please spawn before doing any action.");
if(pAlive[playerid] == 0) return SCM(playerid, COLOR_LIGHTBLUE, "You can't use this command if you are dead.");
new pID, value;
new weap;
GetPlayerWeaponData(playerid, 7, weap,value);
if(sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, -1, "{F70505}Usage: {FFFFFF}/sammo <playerid> <ammo ammount>");
else if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, red, "Invalid id.");
else if(value > GetPlayerAmmo(playerid)) return SendClientMessage(playerid, red, "Your ammo ammount aren't enough to share with.");
//else if(pID == playerid) return SendClientMessage(playerid, red, "You can't share ammo with yourself.");
else if(GetPlayerWeapon(pID) != GetPlayerWeapon(playerid)) return SendClientMessage(playerid, red, "The player needs to have the same gun as you are having.");
else
{
new pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(pID, tName, MAX_PLAYER_NAME);
format(string, sizeof(string), "** You shared %i ammo of your %s to %s (%d)", value,GetWeaponNameByID(weap),tName,pID);
SendClientMessage(playerid, COLOR_CON_GREEN, string);
format(string, sizeof(string), "** You got %i ammo of %s by %s (%d)", value,GetWeaponNameByID(weap),pName,playerid);
SendClientMessage(pID, COLOR_CON_GREEN, string);
SetPlayerAmmo(pID, GetPlayerWeapon(pID), GetPlayerAmmo(pID)+value);
SetPlayerAmmo(pID, GetPlayerWeapon(playerid), GetPlayerAmmo(playerid)-value);
new echo[250];
format(echo, sizeof(echo), "02,3** %s (%d) has shared %i ammo of %s (wid %d) with %s (%d)", pName,playerid,value,GetWeaponNameByID(weap),weap,tName,pID);
IRC_GroupSay(gGroupID, IRC_CHANNEL, echo);
IRC_GroupSay(gGroupID, IRC_ACHANNEL, echo);
}
return 1;
}
CMD:carcolor(playerid,params[])
{
new color;
if(pInfo[playerid][Logged] == 0) return SCM(playerid,0x0080C0FF,"Please login before using this command.");
if(pInfo[playerid][Vip] == 0) return SCM(playerid,0xFF0000FF,"This command is allowed only for VIP players.");
if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
{
if(sscanf(params,"i",color))
{
SendClientMessage(playerid, -1, "Usage: /carcolor [color number]");
SendClientMessage(playerid, -1, "Colors: [0]Black [1]White [2]Blue [3]Red [4]Grayish [5]Pink [6]Yellow [7]Blue [16]Green");
}
ChangeVehicleColor(GetPlayerVehicleID(playerid), color, -1);
}else return SendClientMessage(playerid,red,"Error: You must be in a vehicle.");
return 1;
}
CMD:carcolor(playerid,params[]) { if(pInfo[playerid][Logged] == 0) return SCM(playerid,0x0080C0FF,"Please login before using this command."); if(pInfo[playerid][Vip] == 0) return SCM(playerid,0xFF0000FF,"This command is allowed only for VIP players."); new col1; new col2; new vehicle; if(sscanf(params, "dd", col1, col2)== 0) { if(IsPlayerInAnyVehicle(playerid)) { vehicle = GetPlayerVehicleID(playerid); SendClientMessage(playerid, COLOR_GREEN,"Color ok!"); ChangeVehicleColor(vehicle, col1, col2); } else return SendClientMessage(playerid, COLOR_RED,"Error: You must be in a vehicle!"); } else return SendClientMessage(playerid, COLOR_RED," Colors: [0]Black [1]White [2]Blue [3]Red [4]Grayish [5]Pink [6]Yellow [7]Blue [16]Green!"); return 1; }
in your sammo command the reason why you may be getting "Fist" as the weapon given could be because of this stock: GetWeaponNameByID
Please show this. |
stock GetWeaponNameByID(wid)
{
new gunname[32];
switch (wid)
{
case 1 .. 17,
22 .. 43,
46 : GetWeaponName(wid,gunname,sizeof(gunname));
case 0: format(gunname,32,"%s","Fist");
case 18: format(gunname,32,"%s","Molotov Cocktail");
case 44: format(gunname,32,"%s","Night Vis Goggles");
case 45: format(gunname,32,"%s","Thermal Goggles");
default: format(gunname,32,"%s","Invalid Weapon Id");
}
return gunname;
}