AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved/Old Plugins (https://forums.alliedmods.net/forumdisplay.php?f=27)
-   -   Skin System 2.33 (https://forums.alliedmods.net/showthread.php?t=262077)

DeRoiD 04-27-2015 10:54

Skin System 2.33
 
2 Attachment(s)
Skin System
Version: v2.33
First relase: 2015. 04. 26
Last update: 2015. 05. 03


Description
If you kill enemy with a weapon then have you done +1 weapon point (example ak47) and earn the needed points then collect skin.

Add new skin
Open skins.cfg file [addons/amxmodx/configs/skinsystem/]
Write the new skin
"weapon type" "v mdl (not important)" "p mdl (not important)" "needed kill" "weapon skin name"
examples :
"ak47" "models/papaja_clan/v_ak47.mdl" "" "25" "Asiimov AK47"
"p90" "models/banana_clan/v_p90.mdl" "models/banana_clan/p_p90.mdl" "77" "Carbon P90"

Weapon types
Code:

P228
Scout
He Grenade
XM1014
MAC10
AUG
Elite
Five-Seven
UMP45
SG550
Galil
FAMAS
USP
Glock18
AWP
MP5
M249
M3
M4A1
TMP
G3SG1
Deagle
SG552
AK47
Knife
P90


Cvars
  • skin_s_savemod [Save Mod]
    • 0 - Name (If you have special characters in your player names then use UTF-8 coded. -> save.ini)
    • 1 - Internet Protocol (IP)
    • 2 - Steam ID [default]
Commands
  • My points - /mykills
  • Other player points - /kills "Player name"
  • Show weapon skins - /skins "weapon name"
Screenshots
http://kepfeltoltes.hu/150503/139316...toltes.hu_.jpg
http://kepfeltoltes.hu/150503/277742...toltes.hu_.jpg


C
ompatible AMX versions
  • AMX 1.8.0 [Not tested]
  • AMX 1.8.1 [Not tested]
  • AMX 1.8.2 [Tested] (It works)
  • AMX 1.8.3 [Tested] (It works)

taulalan 04-28-2015 04:36

Re: Skin System
 
Wonderful.
can do better preservation SteamID?

Kia 04-28-2015 07:08

Re: Skin System
 
Why do you save the points by name? Using SteamID is way more secure.

tousif 04-28-2015 08:15

Re: Skin System
 
Quote:

Originally Posted by Kia (Post 2291061)
Why do you save the points by name? Using SteamID is way more secure.

Yea using steam id is more secure :p as by name , anyone can copy name so use steam id

comming to skins just changing color :3 ,instead of that use different skins, cs:go type skins would be awsome

Mordekay 04-28-2015 08:15

Re: Skin System
 
Quote:

Originally Posted by Kia (Post 2291061)
Why do you save the points by name?

Isn't this obvious?

Kia 04-28-2015 10:17

Re: Skin System
 
Quote:

Originally Posted by Mordekay (Post 2291083)
Isn't this obvious?

It is, just wanted him to say it. :fox:

DeRoiD 04-29-2015 12:23

Re: Skin System 2.2
 
I edited.

HamletEagle 04-29-2015 13:23

Re: Skin System 2.2
 
This plugin may be cool if it would be done correctly.
PHP Code:

 Skin[31][SKINSPERWEAPONS],
vSkinMdl[31][SKINSPERWEAPONS][64], pSkinMdl[31][SKINSPERWEAPONS][64],
SkinName[31][SKINSPERWEAPONS][32], 

Instead of hardcoded customizations limit you can use dynamic arrays(or even better, tries, as key save the original weapon name), so anyone can add as much things as they want.

For your information, any array that should be used with player index must have 33 as dimension, not 31.

PHP Code:

register_event("CurWeapon","WeaponModel","be","1=1"); 

Use Ham_Item_Deploy, instead of this.

PHP Code:

get_user_name(PlayerName31); 

Use charsmax() to get string-array size.

PHP Code:

set_task(1.0"LoadPoints"Player); 

Why a delay here ?

PHP Code:

new Weapon get_user_weapon(Player); 

This initialization should be done under the check to see if player is valid.

PHP Code:

if(strlen(vSkinMdl[Weapon][x]) > 5)
set_pev(Playerpev_viewmodel2vSkinMdl[Weapon][x]);
if(
strlen(pSkinMdl[Weapon][x]) > 5)
set_pev(Playerpev_weaponmodel2pSkinMdl[Weapon][x]); 

Indent your code properly.

Using static in plugin_precache(which is called only one time) is useless.
read_file is deprecated native, use new file natives. You should also check if model path is fully valid(it has models/player/model_name and also .mdl extension) and if it exists on the server before precaching it(file_exists can do the job).

If I'm not wrong, you read the skin file two times. Why ?
Instead of intializing new strings, parse directly with vSkinMdl[Num][Already[Num]], so you won't have to call copy.

PHP Code:

new Motd[1024], Line[256];
    
formatex(Line255"<body bgcolor=^"black^">^n<font color=^"red^">^n");
    
add(Motd1023Line255);
    
formatex(Line255"<p align=^"center^">%s %s by: %s</p></font>^n<font color=^"greenyellow^">^n"PLUGINVERSIONAUTHOR);
    
add(Motd1023Line255); 

This just get repedeted every time. For me, it seems that you should do this one time, and add later the things that are context dependent(I mean that can get changed).

Don't acces cvar values inside a loop, cache it before.

There are other improvements that can be done, but this is something to start with(the most obvious mistakes).

DeRoiD 04-29-2015 13:49

Re: Skin System 2.2
 
HamletEagle
31 is not Player ID.
31 is weapon ID.

HamletEagle 04-29-2015 14:05

Re: Skin System 2.2
 
Ooops, nevermind. Just didn't pay attention on how you fill the array.


All times are GMT -4. The time now is 21:47.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.