Errors on sscanf
#2

Код:
dcmd_giveweapon(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 1) {
	  new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index), tmp3 = strtok(params,Index);
	  if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE: /giveweapon [playerid] [weapon id/weapon name] [ammo]");
		new player1 = strval(tmp), weap, ammo, WeapName[32], string[128];
		if(!strlen(tmp3) || !IsNumeric(tmp3) || strval(tmp3) <= 0 || strval(tmp3) > 99999) ammo = 500; else ammo = strval(tmp3);
		if(!IsNumeric(tmp2)) weap = GetWeaponIDFromName(tmp2); else weap = strval(tmp2);
    if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
    	if(!IsValidWeapon(weap)) return SendClientMessage(playerid,red,"ERROR: Invalid weapon ID");
  			CMDMessageToAdmins(playerid,"GIVEWEAPON");
			GetWeaponName(weap,WeapName,32);
			format(string, sizeof(string), "You have given \"%s\" a %s (%d) with %d rounds of ammo", PlayerName2(player1), WeapName, weap, ammo); SendClientMessage(playerid,blue,string);
			if(player1 != playerid) { format(string,sizeof(string),"Administrator \"%s\" has given you a %s (%d) with %d rounds of ammo", PlayerName2(playerid), WeapName, weap, ammo); SendClientMessage(player1,blue,string); }
  			return GivePlayerWeapon(player1, weap, ammo);
	  } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
if u r using ladmin4v2 , that should work good
________
Wellbutrin side effects
Reply


Messages In This Thread
Errors on sscanf - by Christopher. - 21.02.2010, 19:27
Re: Errors on sscanf - by aircombat - 21.02.2010, 19:30
Re: Errors on sscanf - by Christopher. - 21.02.2010, 19:33
Re: Errors on sscanf - by aircombat - 21.02.2010, 19:39
Re: Errors on sscanf - by Christopher. - 21.02.2010, 19:46
Re: Errors on sscanf - by aircombat - 21.02.2010, 19:51
Re: Errors on sscanf - by Christopher. - 23.02.2010, 16:26
Re: Errors on sscanf - by dice7 - 23.02.2010, 16:31
Re: Errors on sscanf - by Miguel - 23.02.2010, 16:40
Re: Errors on sscanf - by Christopher. - 23.02.2010, 17:17

Forum Jump:


Users browsing this thread: 6 Guest(s)