|
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
|
04-19-2016
, 07:26
Re: [Item]Helmet 1.0 + Files
|
#13
|
- new const MaxHelmet = 50;
It will be better to allow unlimited helmets, look for dynamic arrays.
PHP Code:
new cName[33][33]; new cModel[33][64]; new cSubModel[64]; new Float:cHealth[33]; new cCost[33];
Some logical issues here. You set the max helmets to 50 but your arrays are only 33 cells. The 34rd helmet will create an index out of bounds error.
PHP Code:
new szName[32], szModel[64], iSubModel, Float:flHealth, iCost;
used only in LoadConfig. Why are this globals?
PHP Code:
flAvelocity[0] -= flAvelocity[0] / 2; flAvelocity[2] -= flAvelocity[2] / 2;
If you divide in two both parts will be equal. Just do flAvelocity[0] = flAvelocity[0] / 2. Makes more sense. Just saying, doesn't really matter.
- Make sure your entity is valid in fw_Touch.
- You should really use charsmax(), formatex() not format(). Also, where you use sizeof() it's wrong. It should be sizeof -1, so charsmax.
- In LoadConfig:
- Your file is never closed.
- if (!szLineData[0] || szLineData[0] == ';') continue; some issues here. If user put a space before the comment, your code will fail. To fix this, use trim() on szLineData.
- new helmetIndex = 1; why do you start from 1? An array is indexed from 0, not 1.
- szValue[0] != 0 for readability you should check != EOS, '^0' is the null terminator.
- After all, szName, szKey are not needed. Copy szKey directly in cName[helmetIndex], etc. Also, notice I have said copy, not format. When you are not actually formatting and want only to copy a string into another, use copy() native.
- countHelmet = helmetIndex; should be put after the while() loop.
- It will be good to add some safety checks, like if the model really exists before precaching, if the strings you read are not empty, etc.
I just checked 2 or 3 of your functions and found enough issues to unapprove. If you want to support your plugin, PM me when you make some changes.
__________________
Last edited by HamletEagle; 04-19-2016 at 07:33.
|
|
|
|