13.04.2011, 15:56
pawn Код:
COMMAND:giveweapon(playerid,params[]) {
new
weap[30],
weapname[30],
id,
name1[30],
name2[30],
ammo,
text[128];
sscanf(params,"sii",id,weap,ammo);
if(!IsNumeric(weap)) {
format(weap,sizeof(weap),"%i",GetWeaponIDFromName(weap));
}
if(PlayerInfo[playerid][pAdminLevel] >= 4) {
if(!isnull(params)) {
if(IsPlayerConnected(id)) {
//this is where to code shows an error. (type mismatch)
format(weap,sizeof(weap),"%i",weap);
GetWeaponName(weap,weapname,sizeof(weapname));
GetPlayerName(playerid,name1,sizeof(name1));
GetPlayerName(id,name2,sizeof(name2));
if(ammo == 0) {
ammo = 100;
}
format(text,sizeof(text),"Administrator \"%s\" has given \"%s\" a weapon: %s, ammo: %i.",name1,name2,weapname,ammo);
SendClientMessageToAll(COLOR_BLUE,text);
GivePlayerWeapon(id,weap,ammo);
I can't format the weap to be 'compatible' with GetWeaponName.
please DON'T rewrite or correct the code, I just want to know how does it became useable with GetWeaponName.