24.08.2010, 08:48
IN zcmd and sscanf2
okay im probebly way off but this is my current code
it does not work when i type /giveweapon 0 minigun 1000... can anyone tell me why?
okay im probebly way off but this is my current code
Код:
CMD:giveweapon(playerid, params[]) { if(Logged[playerid] == 0) return SendClientMessage(playerid,0xFF0000FF,"You are not logged in!"); if(PlayerInfo[playerid][Level] < 4) return SendClientMessage(playerid,0xFF0000FF,"You have to be Level 4 to use this command!!"); new str[128],weap[128],ammo, id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME],weapon; if(sscanf(params, "usi[128]",id, weap, ammo)) { SendClientMessage(playerid, 0xFF0000FF, "Usage: /giveweapon [ID] [WEAPON] [AMMO]"); return 1; } if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: That player is not connected!"); if(!IsNumeric(weap)) { weapon = GetWeaponIDFromName(weap); return 1; } GetPlayerName(playerid, Name1, sizeof(Name2)); GetPlayerName(id, Name2, sizeof(Name2)); format(str, sizeof(str), "Admin %s has given you a %s with %d's rounds of ammo", Name1, weapon, ammo); SendClientMessage(id, LIMEGREEN, str); format(str, sizeof(str), "You have given %s a %s with %d rounds of ammo", Name2, weapon,ammo); SendClientMessage(playerid, 0xFF0000FF, str); GivePlayerWeapon(id,weapon,ammo); return 1; }