10.05.2013, 22:42
Hello, just finished coding /shareammo cmd (/sammo) where you can share your current weapons ammo with another player. The problem is, it doesn't give ammo at the selected player, and it shows always "Fist" as weapon in the sent message:
The 2nd cmd is /carcolor, it doesn't change color to the vehicle:
Thanks for help.
pawn Код:
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;
}
pawn Код:
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;
}