Raised This Month: $51 Target: $400
 12% 

Subplugin Submission [ZP] Weapon Licenses (natives) [1.0.3]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SergiCruz
Senior Member
Join Date: Mar 2012
Location: Andalucía, España
Old 09-20-2012 , 07:22   [ZP] Weapon Licenses (natives) [1.0.3]
Reply With Quote #1

* This plugin is a bunch of extra items; all of them are licenses.
* Has is own INC with its natives, in order to make it possible to need a license to buy a extra weapons.
* There are 5 licenses (Heavy, Sub, Rifle, Pistols and Shotguns) Edit: 6 licenses; added golden
* You need to edit your extra items (or custom menus) to make them compatible with licenses.
* Once you have purchased one license, you will have them until the end of the map.

Main plugin (OBLIGATORY): zp_licenses
Inc (OBLIGATORY): licenses

Simple example of how to do a extra item with licenses:

PHP Code:
#include <amxmodx>
#include <zombieplague>
#include <cstrike>
#include <fun>
#include <licenses> // This include contains the licenses' natives

#define PLUGIN "This is just an example"
#define VERSION "1.0"
#define AUTHOR "Sergicruz"

// From here nothing important...

new g_mac10

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
g_mac10 zp_register_extra_item("Mac10 + 200B"7ZP_TEAM_HUMAN)
}

// YOU HAVE TO DO THE MODIFICATIONS HERE
public zp_extra_item_selected(iditemid)
{
    if(
itemid == g_mac10)
    {
        if(!
zp_has_user_subs_license(id)) // If user hasn't subs license...
        
{
            
client_print(idprint_chat"You need subs license"// we tell him that he needs it
            
zp_set_user_ammo_packs(id, (zp_get_user_ammo_packs(id) + 7)) //and we give back his ammopacks
        
}
        else{ 
//in other case...
        
give_item(id"weapon_mac10"//we make him happy
        
cs_set_user_bpammo(idCSW_MAC10200// very happy
    
}
    }


Credits:
* Rak: for explaining me how to use natives
* Mercylezz: for his awesome zombie plague
* Ciio: For explaining how to do a simple extra item
* H.Red.Zone: For his help improving the code
* Gogicaa: For helping me with spelling ()
Cooming soon...
* Golden license (or similar) Done
* Cvars for enable/disable licenses
* Natives for detect wether are licenses enabled or disabled
* Natives for giving licenses Done
CHANGELOG:
* First release 20/9/12 13:22
* As H.Red.Zone suggested, added library 20/9/2012 17:45
* As H.Red.Zone suggested, added DEFINE for license cost 20/9/2012 18:03
*
Added golden license (give all licenses) 11/2/2013 20:51
* Added natives for giving licenses 11/2/2013 20:51
Attached Files
File Type: sma Get Plugin or Get Source (example.sma - 1464 views - 1.1 KB)
File Type: inc licenses.inc (433 Bytes, 588 views)
File Type: sma Get Plugin or Get Source (zp_licenses.sma - 1430 views - 5.5 KB)
__________________
PodBot waypointer. Feel free to ask for waypoints for zm_ maps.

Last edited by SergiCruz; 05-04-2013 at 19:16. Reason: Updating
SergiCruz is offline
Send a message via MSN to SergiCruz
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 09-20-2012 , 10:22   Re: [ZP] Weapon Licenses (natives) [1.0.0]
Reply With Quote #2

Nice, Great Idea.

Let me show you how you can improve your code.

Natives.
zp_has_user_silver_license
zp_has_user_golden_license

Code.
Spoiler


Improvements i did and you can copy and see.
* Useing Bits.
* Removed Amxmisc.
* Added define for setting cost.
* I wrote so you can see everything

It was fast i think i didn't made any mistakes.


Suggestions For Your Code:
* Use Bits.
* Look At The Code I Gave You.
* Add (Admin Licence) (Premium Licence) Not Only ShotGun And So On...
* You Can Add (Golden Licence || Silver Licence)
* Show People How They Can Set Checks.
(If I get Any More Suggestions I Will Tell You X)

And Again Nice Job And Great Idea.

EDIT: You Forgot to register the lybrary.
Code:
    // Register Lybrary.
    register_library( "licenses" )
__________________

Last edited by H.RED.ZONE; 09-20-2012 at 10:29.
H.RED.ZONE is offline
gogicaa
Veteran Member
Join Date: Aug 2011
Location: //
Old 09-20-2012 , 10:26   Re: [ZP] Weapon Licenses (natives) [1.0.0]
Reply With Quote #3

Wow, great idea Sergi
Unfortunately, i don't have time to test it...
gogicaa is offline
SergiCruz
Senior Member
Join Date: Mar 2012
Location: Andalucía, España
Old 09-20-2012 , 11:15   Re: [ZP] Weapon Licenses (natives) [1.0.0]
Reply With Quote #4

@H.Red.Zone: I didn't understand very well your plugin, i'm not so good at scripting. Anyway, i'll try to learn some things from your code so... thanks very much!! For the moment, Lybrary added and amxmisc deleted
@gogicaa: Thanks I hope to have the time to improve it.
__________________
PodBot waypointer. Feel free to ask for waypoints for zm_ maps.

Last edited by SergiCruz; 09-20-2012 at 11:19.
SergiCruz is offline
Send a message via MSN to SergiCruz
gogicaa
Veteran Member
Join Date: Aug 2011
Location: //
Old 09-20-2012 , 12:11   Re: [ZP] Weapon Licenses (natives) [1.0.2]
Reply With Quote #5

Oh, and it not CHANGELOG, not CHANGELOT
gogicaa is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 09-20-2012 , 12:17   Re: [ZP] Weapon Licenses (natives) [1.0.0]
Reply With Quote #6

Quote:
Originally Posted by SergiCruz View Post
@H.Red.Zone: I didn't understand very well your plugin, i'm not so good at scripting. Anyway, i'll try to learn some things from your code so... thanks very much!! For the moment, Lybrary added and amxmisc deleted
If you need explanation feel free to PM me.
__________________
H.RED.ZONE is offline
SergiCruz
Senior Member
Join Date: Mar 2012
Location: Andalucía, España
Old 09-20-2012 , 12:19   Re: [ZP] Weapon Licenses (natives) [1.0.2]
Reply With Quote #7

Quote:
Oh, and it not CHANGELOG, not CHANGELOT
hahaha thanks dude
Quote:
If you need explanation feel free to PM me.
Thanks!! i think it's better with bits, but i don't know how to use them. I will read something about them and then, i'll ask you
__________________
PodBot waypointer. Feel free to ask for waypoints for zm_ maps.

Last edited by SergiCruz; 09-20-2012 at 12:21.
SergiCruz is offline
Send a message via MSN to SergiCruz
SergiCruz
Senior Member
Join Date: Mar 2012
Location: Andalucía, España
Old 02-11-2013 , 15:00   Re: [ZP] Weapon Licenses (natives) [1.0.3]
Reply With Quote #8

(Sorry for double-posting)
Updated [11/2/2013]. Changes in changelog. It needs a re-download.
__________________
PodBot waypointer. Feel free to ask for waypoints for zm_ maps.
SergiCruz is offline
Send a message via MSN to SergiCruz
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:56.


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