View Single Post
Mitchell
~lick~
Join Date: Mar 2010
Old 04-13-2014 , 08:45   Re: Change Weapon Size
Reply With Quote #2

So far not bad, pretty short, hope to see more out of this! if you need any referencing then by all means go onto MstrOfXP's sandbox and check out his weapon resizer.

Heres a few recommendations:
i would change this:
Code:
	if(!IsClientConnected(client) || !IsClientInGame(client) || !IsPlayerAlive(client))
	{
		ReplyToCommand(client, "[WeaponSize] You must be alive");
		return Plugin_Handled;
	}
to:
Code:
	if(!IsClientInGame(client))
		return Plugin_Handled;
	
	if(!IsPlayerAlive(client))
	{
		ReplyToCommand(client, "[WeaponSize] You must be alive");
		return Plugin_Handled;
	}
i also recommend adding in a feature so if a player inputs "sm_weaponsize" with no arg and he already has his weapon size set, then to default it back to normal.

and huge problem here:
Code:
	new Float:fArg = StringToFloat(cmdArg);
heres the reason: say a player enters: !ws LOL
it would set his weapon size to 0.0
when things are size 0.0, things seem to crash, especially if some one were to remove that weapon from the client's hand.
something like this would help:
Code:
	if(fArg <= 0.0)
	{
		ReplyToCommand(client, "[WeaponSize] Weapon size must be greater than 0.0!");
		return Plugin_Handled;
	}
or just set the fArg to default(1.0) or to the lowest anyone should go (0.1) which ever you choose would be fine.

Code:
		new String:cmdName[22];
		GetCmdArg(0, cmdName, sizeof(cmdName));
		ReplyToCommand(client, "[WeaponSize] Usage: %s #", cmdName);
Why get the command name? I mean i know why, i guess this is just a personal preference.

I would use decl for your strings since you are filling them right after any ways.
Mitchell is offline