Raised This Month: $32 Target: $400
 8% 

Nickname money (Only to modify)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Razvann.
Senior Member
Join Date: Jul 2012
Old 12-01-2020 , 23:13   Nickname money (Only to modify)
Reply With Quote #1

Hello guys! Can somebody please modify this for me? I only want to give money for Nickname_part (i dont want to give weapons, armour, kevlar etc..)
Thanks!

Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "xFlane"
#define PLUGIN_VERSION "1.00"

#define NICKNAME_PART "alliedmodders"

#define PREFIX "[SM]"

#include <sourcemod>
#include <sdktools>

#define CHANCE_TO_RECEIVE_MONEY 33
#define CHANCE_TO_WEAPON CHANCE_TO_RECEIVE_MONEY + 33
#define CHANCE_TO_KEVLAR CHANCE_TO_WEAPON + 33


int moneyGifts[] = 
{
	500,
	1500,
	2500,
	3500,
	4500,
	6500,
	7500,
	8500
};

char itemGifts[][] = 
{
	"weapon_ak47",
	"weapon_m4a1",
	"weapon_awp",
	"weapon_deagle"
};

#pragma newdecls required

EngineVersion g_Game;

public Plugin myinfo = 
{
	name = "[SM] Nickname random gifts.",
	author = PLUGIN_AUTHOR,
	description = "",
	version = PLUGIN_VERSION,
	url = "http://steamcommunity.com/id/xflane/"
};

public void OnPluginStart()
{
	g_Game = GetEngineVersion();
	if(g_Game != Engine_CSGO && g_Game != Engine_CSS)
	{
		SetFailState("This plugin is for CSGO/CSS only.");	
	}
	
	HookEvent("player_spawn", Event_Spawn);
}

public Action Event_Spawn(Event event, const char[] name, bool dontBroadcast)
{
	int client = GetClientOfUserId(event.GetInt("userid"));
	
	char clientName[32];
	GetClientName(client, clientName, 32);
	
	if(StrContains(clientName, NICKNAME_PART) > -1)
	{
		int num = GetRandomInt(0, 100);
		if(num <= CHANCE_TO_RECEIVE_MONEY)
		{
			int money = moneyGifts[GetRandomInt(0, sizeof(moneyGifts) - 1)];
			PrintToChat(client, "%s You have received \x04%i$\x01, because you have \x04%s\x01 in your name", PREFIX, money, NICKNAME_PART);
			money += GetEntProp(client, Prop_Send, "m_iAccount");
			SetEntProp(client, Prop_Send, "m_iAccount", money > 16000 ? 16000 : money);
		}
		else if(num <= CHANCE_TO_WEAPON)
		{
			char weapon[32];
			strcopy(weapon, 32, itemGifts[GetRandomInt(0, sizeof(itemGifts) - 1)]);
			GivePlayerItem(client, weapon);
			ReplaceString(weapon, 32, "weapon_", "");
			PrintToChat(client, "%s You have received \x04%s\x01, because you have \x04%s\x01 in your name.", PREFIX, weapon, NICKNAME_PART);
		}
		else if(num <= CHANCE_TO_KEVLAR)
		{
			SetEntProp(client, Prop_Send, "m_bHasHelmet", 1);
			SetEntProp(client, Prop_Send, "m_ArmorValue", 100);
			PrintToChat(client, "%s You have received \x04kevlar\x01, because you have \x04%s\x01 in your name.", PREFIX, NICKNAME_PART);
		}
	
	}
}
Razvann. is offline
Send a message via Yahoo to Razvann.
ho83
Senior Member
Join Date: Aug 2020
Location: iran
Old 12-02-2020 , 04:26   Re: Nickname money (Only to modify)
Reply With Quote #2

Here is the AMX Mod X section.
ho83 is offline
Razvann.
Senior Member
Join Date: Jul 2012
Old 12-02-2020 , 10:17   Re: Nickname money (Only to modify)
Reply With Quote #3

My bad!
Razvann. is offline
Send a message via Yahoo to Razvann.
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 12-02-2020 , 10:22   Re: Nickname money (Only to modify)
Reply With Quote #4

In case somebody wants a small such plugin for Amxx. It would be better to start over on SM as well or just find an existing money plugin there.

Code:
#include amxmodx #include amxmisc #include cstrike public plugin_init() {     register_plugin("SugarX҉Daddy", "A-", ".sρiηX҉.")     register_concmd("amx_givemoney","admin_givemoney",ADMIN_LEVEL_C," <nick, #userid, authid or @team> <amount> - gives specified player money")     } public admin_givemoney(id,level,cid) {     if(!cmd_access(id,level,cid,3))         return PLUGIN_HANDLED         new arg[32], arg2[32]     read_argv(1,arg,32)     read_argv(2,arg2,31)         new adminAuthid[36], adminName[32]     get_user_authid(id,adminAuthid,35)     get_user_name(id,adminName,31)         new amount = str_to_num(arg2)     if(amount < 0) {         return PLUGIN_HANDLED     }         if(arg[0] == '@')     {         new players[32], pnum, i;         if(containi(arg, "ALL") != -1) get_players(players, pnum)         else get_players(players, pnum, "ae", (containi(arg, "CT") != -1) ? "CT" : "TERRORIST");         if(!pnum) return PLUGIN_HANDLED;         new pid, money;         for(i = 0; i < pnum; i++)         {             pid = players[i];             money = amount + cs_get_user_money(pid);             if(money > 16000) money = 16000;             cs_set_user_money(pid, money)         }     }     else     {                 new player = cmd_target(id,arg,2)         if(!player) return PLUGIN_HANDLED             new playerName[32]         get_user_name(player,playerName,31)                 new playerAuthid[36]         get_user_authid(player,playerAuthid,35)             cs_set_user_money(player,cs_get_user_money(player)+amount)             }     return PLUGIN_HANDLED }
__________________
DJEarthQuake is offline
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 15:19.


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