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; }
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 id, weap[128], ammo; if(sscanf(params, "us[35]i",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!"); GivePlayerWeapon(id,GetWeaponIDFromName(weap),ammo); return 1; }
okay guys sorry for the double post but i solved it myself, and help from kyosaur heres the finished code it works great:
Код:
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 id, weap[128], ammo; if(sscanf(params, "us[35]i",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!"); GivePlayerWeapon(id,GetWeaponIDFromName(weap),ammo); return 1; } |
Why are you doing stuff like [128] and [35] in sscanf? delete that.
|