This is just an example:
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <YourXP.inc> // Your EXP need to have dynamic native so that we can use it in other plugin
public plugin_init()
{
register_plugin("Simple", "1.0", "Pro7")
// The command to buy the gun
register_clcmd("say /buygun", "Simple")
register_clcmd("say_team /buygun", "Simple")
}
public Simple(id)
{
// "get_user_exp" is the dynamic native that to get the player EXP
// So, we make a check whether the player has the minimum EXP to
// buy the gun. 50 is the value of the gun.
if (get_user_exp(id) > 50)
{
// "del_user_exp" is the dynamic native that we used to deduct player
// EXP. Below, when player say /buygun his EXP will be deducted
// by 50.
del_user_exp(id, 50)
// Then we give the weapon
give_item(id,"weapon_sg550")
give_item(id,"ammo_556nato")
give_item(id,"ammo_556nato")
give_item(id,"ammo_556nato")
}
// If the player do not have minimum EXP, then he cannot buy it
else
{
// We tell the player that he cannot buy the gun
client_print(id, print_chat, "[Test] Sorry, you do not have minimum EXP to buy the gun!")
}
}