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

[CS:GO] MyJailShop (a redux rewrite of Jail Shop) [1.5.0 / 20-08-18]


Post New Thread Reply   
 
Thread Tools Display Modes
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 05-18-2018 , 16:12   Re: [CS:GO] MyJailShop (a redux rewrite of Jail Shop) [1.4.0 / 31-08-17]
Reply With Quote #101

Sorry guys, somehow I missed your posts...

Quote:
Originally Posted by j1gg View Post
I found bug, when u buy gold knife and throw granade is killing someone for 1 hit.
thanks for the report. We'll have a look.

Quote:
Originally Posted by Lannister View Post
Been using the original "Jailshop" made by Dkmuniz since years, i wonder if the credits that everyone has stored in the server will "work" if i update the Jailshop from Dkmuniz to this one? (since it's a redux version)?, this probably was answered but i couldn't find the answer.

Thanks in advance!
nope, this wasn't answered nor asked before.
There are some different versions of Dkmuniz jailshop in circulation, the original - attached to his thread - use clientprefs (cookies) to store credits. Others have MySQL support.

Cookies:
1. Since MyJS is modular and can use different "credit-systems", it should be possible to make a module to use the old cookies of Dkmuniz jailshop.

2. Otherwise you could use an SQLite editor, backup & open the clientprefs-sqlite.sq3 and rename the sm_cookies name from 'Creditos' to 'Credits'

MySQL:
3. With Mysql we could also make a new module which interacts with the old database(-structure).

4. But here I think it's better to copy the data from old to a new database with the appropriate structure. It should be 'easy' to make a sql-script to automate this.

I would be happy when you could afford the solutions 2. or 4. for yourself.

I'm not sure if it's worth it for me to make these modules, since there is a huge fragmentation of different versions and I don't know how many people out there are on which JS version who wanna migrate to MyJS.

If there is a great demand, I will do my best.
__________________
free software
coding

Last edited by shanapu; 05-18-2018 at 16:29.
shanapu is offline
September
Senior Member
Join Date: Jul 2015
Location: Russian Federation
Old 08-01-2018 , 07:24   Re: [CS:GO] MyJailShop (a redux rewrite of Jail Shop) [1.4.0 / 31-08-17]
Reply With Quote #102

Version: 1.4.1.dev-3c9925d
HTML Code:
L 08/01/2018 - 13:21:28: Info (map "ba_jail_Bravo") (file "errors_20180801.log")
L 08/01/2018 - 13:21:28: [SM] Exception reported: Client index 0 is invalid
L 08/01/2018 - 13:21:28: [SM] Blaming: MyJailbreak/myjailshop.smx
L 08/01/2018 - 13:21:28: [SM] Call stack trace:
L 08/01/2018 - 13:21:28: [SM]   [0] IsClientInGame
L 08/01/2018 - 13:21:28: [SM]   [1] Line 3129, addons/sourcemod/scripting/myjailshop.sp::Timer_WelcomeMessage
L 08/01/2018 - 13:37:21: Error log file session closed.
September is offline
Send a message via Skype™ to September
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 08-01-2018 , 15:39   Re: [CS:GO] MyJailShop (a redux rewrite of Jail Shop) [1.4.0 / 31-08-17]
Reply With Quote #103

Quote:
Originally Posted by September View Post
Version: 1.4.1.dev-3c9925d
HTML Code:
L 08/01/2018 - 13:21:28: Info (map "ba_jail_Bravo") (file "errors_20180801.log")
L 08/01/2018 - 13:21:28: [SM] Exception reported: Client index 0 is invalid
L 08/01/2018 - 13:21:28: [SM] Blaming: MyJailbreak/myjailshop.smx
L 08/01/2018 - 13:21:28: [SM] Call stack trace:
L 08/01/2018 - 13:21:28: [SM]   [0] IsClientInGame
L 08/01/2018 - 13:21:28: [SM]   [1] Line 3129, addons/sourcemod/scripting/myjailshop.sp::Timer_WelcomeMessage
L 08/01/2018 - 13:37:21: Error log file session closed.
thanks for report. fixed this harmless error on latest dev.
__________________
free software
coding
shanapu is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 08-20-2018 , 17:27   Re: [CS:GO] MyJailShop (a redux rewrite of Jail Shop) [1.5.0 / 20-08-18]
Reply With Quote #104

new update 1.5.0!
dev branch merged to master

ChangeLog
Spoiler
__________________
free software
coding
shanapu is offline
NanoC
Senior Member
Join Date: Jan 2016
Location: Argentina
Old 08-21-2018 , 12:19   Re: [CS:GO] MyJailShop (a redux rewrite of Jail Shop) [1.5.0 / 20-08-18]
Reply With Quote #105

Hey shanapu, is there a way to include some of this items inside of this plugin?

Code:
Guards & prisoner / CT & T - both:
No Damage / Immortal 
Wallhack for x sec.  (optional - need CustomPlayerSkins)
Ice grenade *
Parachute *
Tactical shield *

Prisoner / Terrorist - only:
Open Cells  (optional - need smartjaildoors)
Teleport smoke 
Poison smoke 
One hit Knife 
Three bullets Taser 
Open door in sight *
Jihad *
MyJB Freeday *
HTML Code:
#include <sourcemod>
#include <sdktools>
#include <sdktools_sound>
#include <cstrike>
#include <sdkhooks>
#include <clientprefs>

#pragma semicolon 1

#define VERSION "1.3"

#define PRECIO_VELOCIDADN		    0
#define PRECIO_SMOKE				6
#define PRECIO_FLASH				8
#define PRECIO_50HP					8
#define PRECIO_VELOCIDAD			9
#define PRECIO_HEGRENADE			9
#define PRECIO_MOLOTOV				12
#define PRECIO_TRAJEPOLI			15
#define PRECIO_FIDEO				20
#define PRECIO_GALLINA				25
#define PRECIO_FIDEODIMARIA			28
#define PRECIO_PAJARO				30
#define PRECIO_INVISIBLE			32
#define PRECIO_INMORTAL				35
#define PRECIO_GALLINAZOMBIE		40



new g_iCredits[MAXPLAYERS+1];
new bool:g_Fly[MAXPLAYERS+1] = {false, ...};
new bool:g_Godmode[MAXPLAYERS+1] = {false, ...};
new bool:g_AmmoInfi[MAXPLAYERS+1] = {false, ...};

new Handle:cvarCreditsMax = INVALID_HANDLE;
new Handle:cvarAwardsEnable = INVALID_HANDLE;
new Handle:cvarCreditsKill = INVALID_HANDLE;
new Handle:cvarCreditsSave = INVALID_HANDLE;

new activeOffset = -1;
new clip1Offset = -1;
new clip2Offset = -1;
new secAmmoTypeOffset = -1;
new priAmmoTypeOffset = -1;
new invisiblePlayers[33];

new Handle:cvarInterval;
new Handle:AmmoTimer;

new Handle:c_GameCredits = INVALID_HANDLE;

public Plugin:myinfo =
{
    name = "SM Franug Jail Awards",
    author = "Franc1sco steam: franug",
    description = "For buy awards in jail",
    version = VERSION,
    url = "http://servers-cfg.foroactivo.com/"
};

public OnPluginStart()
{
	LoadTranslations("common.phrases");
	c_GameCredits = RegClientCookie("Credits", "Credits", CookieAccess_Private);
	
	// ======================================================================

	HookEvent("player_spawn", PlayerSpawn);
	HookEvent("player_death", PlayerDeath);
	
	//HookEvent("player_hurt", Event_hurt);
	//HookEvent("player_jump", PlayerJump);
    
    // ======================================================================

	RegConsoleCmd("sm_awards", DOMenu);
	RegConsoleCmd("sm_creditos", VerCreditos);
	RegAdminCmd("sm_darcreditos", FijarCreditos, ADMFLAG_ROOT);
    
    // ======================================================================
    
    // ======================================================================
    
	cvarAwardsEnable = CreateConVar("awards_enable", "1", "Enable/Disable Jail Awards (Default 1)");
	cvarCreditsMax = CreateConVar("awards_credits_max", "50", "max of credits allowed (0: No limit)");
	cvarCreditsKill = CreateConVar("awards_credits_kill", "1", "credits for kill");
	cvarCreditsSave = CreateConVar("awards_credits_save", "1", "enable or disable that credits can be saved");
	
	// unlimited ammo by http://forums.alliedmods.net/showthread.php?t=107900
	cvarInterval = CreateConVar("ammo_interval", "5", "How often to reset ammo (in seconds).", _, true, 1.0);
	activeOffset = FindSendPropInfo("CAI_BaseNPC", "m_hActiveWeapon");
	CreateConVar("sm_jailawards_version", VERSION, "plugin info", FCVAR_SPONLY|FCVAR_NOTIFY|FCVAR_DONTRECORD);

	clip1Offset = FindSendPropInfo("CBaseCombatWeapon", "m_iClip1");
	clip2Offset = FindSendPropInfo("CBaseCombatWeapon", "m_iClip2");
	
	priAmmoTypeOffset = FindSendPropInfo("CBaseCombatWeapon", "m_iPrimaryAmmoCount");
	secAmmoTypeOffset = FindSendPropInfo("CBaseCombatWeapon", "m_iSecondaryAmmoCount");
	
	if(GetConVarBool(cvarCreditsSave))
	{
		for(new client = 1; client <= MaxClients; client++)
    	{
			if(IsClientInGame(client))
			{
				if(AreClientCookiesCached(client))
				{
					OnClientCookiesCached(client);
				}
			}
		}
	}
}

public OnPluginEnd()
{
	if(!GetConVarBool(cvarCreditsSave))
		return;

	for(new client = 1; client <= MaxClients; client++)
	{
		if(IsClientInGame(client))
		{
			OnClientDisconnect(client);
		}
	}
}

public OnClientCookiesCached(client)
{
	if(!GetConVarBool(cvarCreditsSave))
		return;

	new String:CreditsString[12];
	GetClientCookie(client, c_GameCredits, CreditsString, sizeof(CreditsString));
	g_iCredits[client]  = StringToInt(CreditsString);
}

public OnClientDisconnect(client)
{
	if(invisiblePlayers[client] == 1)
	{
		SetEntityRenderMode(client, RENDER_TRANSCOLOR);
		SetEntityRenderColor(client, 255, 255, 255, 255);
		invisiblePlayers[client] = 0;
	}
	
	if(!GetConVarBool(cvarCreditsSave))
	{
		g_iCredits[client] = 0;
		return;
	}

	if(AreClientCookiesCached(client))
	{
		new String:CreditsString[12];
		Format(CreditsString, sizeof(CreditsString), "%i", g_iCredits[client]);
		SetClientCookie(client, c_GameCredits, CreditsString);
	}
}

public OnMapStart()
{
	PrecacheModel("models/props/cs_militia/toilet.mdl");
	PrecacheModel("models/pigeon.mdl");
	PrecacheModel("models/crow.mdl");
	PrecacheModel("models/props/de_inferno/chairantique.mdl");
}

public OnConfigsExecuted()
{	
	if (AmmoTimer != INVALID_HANDLE){
		KillTimer(AmmoTimer);
	}
	new Float:interval = GetConVarFloat(cvarInterval);
	
	for(new i=0; i<sizeof(invisiblePlayers); i++)
	{
		invisiblePlayers[i] = 0;
	}
	
	AmmoTimer = CreateTimer(interval, ResetAmmo, _, TIMER_REPEAT);
}

public Action:MensajesSpawn(Handle:timer, any:client)
{
	if(GetConVarBool(cvarAwardsEnable)){
		if (IsClientInGame(client))
		{
		PrintToChat(client, "\x04[RAGE Awards] \x05Matar a los COVANI para Ganar Creditos!");
		PrintToChat(client, "\x04[RAGE -Awards] \x05Escribir \x03!awards \x05Para comprar sus Premios");
		}
	}
}

public Action:PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
	if(GetConVarBool(cvarAwardsEnable)){
		new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
		new client = GetClientOfUserId(GetEventInt(event, "userid"));
		
		if(invisiblePlayers[client] == 1)
		{
			SetEntityRenderMode(client, RENDER_TRANSCOLOR);
			SetEntityRenderColor(client, 255, 255, 255, 255);
			invisiblePlayers[client] = 0;
		}

		CreateTimer(2.0, MensajesMuerte, client);
		
		if (!attacker)
			return;
			
		if (attacker == client)
			return;
		
		if( GetClientTeam( client ) == 3)
		{		
			g_iCredits[attacker] += GetConVarInt(cvarCreditsKill);
			
			if (g_iCredits[attacker] < GetConVarInt(cvarCreditsMax))
			{
				PrintToChat(attacker, "\x04[RAGE Awards] \x05Tus Creditos: %i (+%i)", g_iCredits[attacker],GetConVarInt(cvarCreditsKill));
			}
			else
			{
				g_iCredits[attacker] = GetConVarInt(cvarCreditsMax);
				PrintToChat(attacker, "\x04[RAGE Awards] \x05Tus Creditos: %i (Maximum allowed)", g_iCredits[attacker]);
			}
		
		}
	
	}
}

public Action:MensajesMuerte(Handle:timer, any:client)
{
	if(GetConVarBool(cvarAwardsEnable)){
		 if (IsClientInGame(client))
		 {
		   PrintToChat(client, "\x04[RAGE Awards] \x05Has Muerto, Te has Jodido! Espera a la Siguiente Ronda para Revelarte y no Seas Cagon)");
		 }
	}
}

public Action:VerCreditos(client, args)
{
	if(GetConVarBool(cvarAwardsEnable)){
		if(client == 0)
		{
			PrintToServer("%t","Command is in-game only");
			return;
		}
		PrintToChat(client, "\x04[RAGE Awards] \x05Sus Creditos Actuales son: %i", g_iCredits[client]);
	}
}

public Action:DOMenu(client,args)
{
	if(GetConVarBool(cvarAwardsEnable)){
		if(GetClientTeam(client) != 2)
		{
			 PrintToChat(client, "\x04[RAGE Awards] \x05Solo lo pueden usar los Terrorista");
			 return;
		}

		DID(client);
		PrintToChat(client, "\x04[RAGE Awards] \x05Tus Creditos: %i", g_iCredits[client]);
	}
}

public Action:DID(clientId) 
{
	new Handle:menu = CreateMenu(DIDMenuHandler);
	SetMenuTitle(menu, "Awards of store. Your credits: %i", g_iCredits[clientId]);
	AddMenuItem(menu, "option_smoke", "Smoke -  6  Creditos");
	AddMenuItem(menu, "option_flash", "Flash -  8  Creditos");
	AddMenuItem(menu, "option_50hp", "+50 HP - 8  Creditos");
	AddMenuItem(menu, "option_velocidad", "Mas Velocidad - 9  Creditos");		
	AddMenuItem(menu, "option_hegrenade", "Granada - 9  Creditos");
	AddMenuItem(menu, "option_molotov", "Molotov - 12  Creditos");
	AddMenuItem(menu, "option_trajepoli", "Traje de policia  - 15 Creditos");
	AddMenuItem(menu, "option_fideo", "Fideo - 20 Creditos");
	AddMenuItem(menu, "option_gallina", "Convertirse en una Gallina  - 25 Creditos");		
	AddMenuItem(menu, "option_fideodimaria", "Fideo Di Maria - 28 Creditos");
	AddMenuItem(menu, "option_pajaro", "Convertirse en Pajaro - 30  Credits");	
	AddMenuItem(menu, "option_invisible", "Invisible (10seg) - 32 Creditos");	
	AddMenuItem(menu, "option_inmortal", "INMORTAL (10seg) - 35 Creditos");
	AddMenuItem(menu, "option_gallinazombie", "GALLINA ZOMBIE - 40 Creditos");		
	AddMenuItem(menu, "option_velocidadn", "Velocidad normal -  Gratis");
	SetMenuExitButton(menu, true);
	DisplayMenu(menu, clientId, MENU_TIME_FOREVER);
    
	return Plugin_Handled;
}

public DIDMenuHandler(Handle:menu, MenuAction:action, client, itemNum) 
{
	if ( action == MenuAction_Select ) 
    {
		new String:info[32];
		GetMenuItem(menu, itemNum, info, sizeof(info));
		if ( strcmp(info,"option1") == 0 ) 
		{
			DID(client);
			PrintToChat(client,"\x04[RAGE Awards] \x05Mata policias para ganar creditos.");
			//PrintToChat(client, "\x04[RAGE Awards] \x05Version:\x03 %s \x05created for SourceMod.", VERSION);
		}
		else if ( strcmp(info,"option_smoke") == 0 ) 
        {
			DID(client);
			if (g_iCredits[client] >= PRECIO_SMOKE)
			{
			   if (IsPlayerAlive(client))
			   {
				  GivePlayerItem(client, "weapon_smokegrenade");
				  g_iCredits[client] -= PRECIO_SMOKE;
				  PrintToChat(client, "\x04[RAGE Awards] \x05Ahora tienes una Smoke! Tus Creditos: %i (-%i)", g_iCredits[client], PRECIO_SMOKE);
			   }
			   else
			   {
				  PrintToChat(client, "\x04[RAGE Awards] \x05Tienes que estar Vivo, para Comprar Premios");
			   }
			}
			else
			{
			PrintToChat(client, "\x04[RAGE Awards] \x05Tus Creditos: %i (No tienes Suficientes Creditos! Necesitas %i)", g_iCredits[client], PRECIO_SMOKE);
			} 
        }
		else if ( strcmp(info,"option_flash") == 0 ) 
        {
			DID(client);
			if (g_iCredits[client] >= PRECIO_FLASH)
			{
				if (IsPlayerAlive(client))
				{
					GivePlayerItem(client, "weapon_flashbang");
					g_iCredits[client] -= PRECIO_FLASH;
					PrintToChat(client, "\x04[RAGE Awards] \x05Ahora Tienes una Flash! Tus Creditos: %i (-i)", g_iCredits[client], PRECIO_FLASH);
				}
				else
				{
					PrintToChat(client, "\x04[RAGE Awards] \x05Tienes que estar Vivo, para Comprar Premios");
				}
			}
			else
			{
				PrintToChat(client, "\x04[RAGE Awards] \x05Tus Creditos: %i (No tienes Suficientes Creditos! Necesitas %i)", g_iCredits[client], PRECIO_FLASH);
			}  
        }
		else if ( strcmp(info,"option_50hp") == 0 ) 
        {
			DID(client);
			if (g_iCredits[client] >= PRECIO_50HP)
			{
				if (IsPlayerAlive(client))
				{
					SetEntityHealth(client, 150);
					g_iCredits[client] -= PRECIO_50HP;
					PrintToChat(client, "\x04[RAGE Awards] \x05Ahora tienes 150 HP ! Tus Creditos: %i (%i)", g_iCredits[client], PRECIO_50HP);
				}
				else
				{
					PrintToChat(client, "\x04[RAGE Awards] \x05Tienes que estar Vivo, para Comprar Premios");
				}
			}
			else
			{
				PrintToChat(client, "\x04[RAGE Awards] \x05Tus Creditos: %i (No tienes Suficientes Creditos! Necesitas %i)", g_iCredits[client], PRECIO_50HP);
			}
        }
		else if ( strcmp(info,"option_velocidad") == 0 ) 
        {
			DID(client);
			if (g_iCredits[client] >= PRECIO_VELOCIDAD)
			{
				if (IsPlayerAlive(client))
				{
					SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.3);
					g_iCredits[client] -= PRECIO_VELOCIDAD;
					PrintToChat(client, "\x04[RAGE Awards] \x05Ahora eres mas Rapido! Tus Creditos: %i (%i)", g_iCredits[client], PRECIO_VELOCIDAD);
				}
				else
				{
					PrintToChat(client, "\x04[RAGE Awards] \x05Tienes que estar Vivo, para Comprar Premios");
				}
			}
			else
			{
				PrintToChat(client, "\x04[RAGE Awards] \x05Tus Creditos: %i (No tienes Suficientes Creditos! Necesitas %i)", g_iCredits[client], PRECIO_VELOCIDAD);
			}            
        }
		else if ( strcmp(info,"option_velocidadn") == 0 ) 
        {
			DID(client);
			if (g_iCredits[client] >= PRECIO_VELOCIDADN)
			{
				if (IsPlayerAlive(client))
				{
					SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.0);
					g_iCredits[client] -= PRECIO_VELOCIDADN;
					PrintToChat(client, "\x04[RAGE Awards] \x05Ahora corres normal. Tus Creditos: %i (%i)", g_iCredits[client], PRECIO_VELOCIDADN);
				}
				else
				{
					PrintToChat(client, "\x04[RAGE Awards] \x05Tienes que estar Vivo, para Comprar Premios");
				}
			}
			else
			{
				PrintToChat(client, "\x04[RAGE Awards] \x05Tus Creditos: %i (No tienes Suficientes Creditos! Necesitas %i)", g_iCredits[client], PRECIO_VELOCIDADN);
			}            
        }		
		else if ( strcmp(info,"option_hegrenade") == 0 ) 
		{
			DID(client);
			if (g_iCredits[client] >= PRECIO_HEGRENADE)
			{
				if (IsPlayerAlive(client))
				{
					GivePlayerItem(client, "weapon_hegrenade");
					g_iCredits[client] -= PRECIO_HEGRENADE;
					PrintToChat(client, "\x04[RAGE Awards] \x05Ahora tienes una Granada! Tus Creditos: %i (%i)", g_iCredits[client], PRECIO_HEGRENADE);
				}
				else
				{
					PrintToChat(client, "\x04[RAGE Awards] \x05Tienes que estar vivo para Comprar");
				}
			}
			else
			{
				PrintToChat(client, "\x04[RAGE Awards] \x05Tus Creditos: %i (No tienes Suficientes Creditos! Necesitas %i)", g_iCredits[client], PRECIO_HEGRENADE);
			}      
        }
		else if ( strcmp(info,"option_molotov") == 0 ) 
        {
			DID(client);
			if (g_iCredits[client] >= PRECIO_MOLOTOV)
			{
				if (IsPlayerAlive(client))
				{
					GivePlayerItem(client, "weapon_molotov");
					g_iCredits[client] -= PRECIO_MOLOTOV;
					PrintToChat(client, "\x04[RAGE Awards] \x05Ahora tienes una Granada Molotov! Tus Creditos: %i (%i)", g_iCredits[client], PRECIO_MOLOTOV);
				}
				else
				{
					PrintToChat(client, "\x04[RAGE Awards] \x05Tienes que estar vivo para Comprar");
				}
			}
			else
			{
				PrintToChat(client, "\x04[RAGE Awards] \x05Tus Creditos: %i (No tienes Suficientes Creditos! Necesitas %i)", g_iCredits[client], PRECIO_MOLOTOV);
			}
        }
		else if ( strcmp(info,"option_trajepoli") == 0 ) 
        {
			DID(client);
			if (g_iCredits[client] >= PRECIO_TRAJEPOLI)
			{
				if (IsPlayerAlive(client))
				{
					SetEntityModel(client, "models/player/custom_player/kuristaja/jailbreak/guard1/guard1.mdl");
					g_iCredits[client] -= PRECIO_TRAJEPOLI;
					PrintToChat(client, "\x04[RAGE Awards] \x05Te Convertiste en un Policia Infiltrado! Tus Creditos: %i (%i)", g_iCredits[client], PRECIO_TRAJEPOLI);
				}
				else
				{
					PrintToChat(client, "\x04[RAGE Awards] \x05Tienes que estar vivo para Comprar");
				}
			}
			else
			{
				PrintToChat(client, "\x04[RAGE Awards] \x05Tus Creditos: %i (No tienes Suficientes Creditos! Necesitas %i)", g_iCredits[client], PRECIO_TRAJEPOLI);
			}
        }
		else if ( strcmp(info,"option_gallina") == 0 ) 
        {
			DID(client);
			if (g_iCredits[client] >= PRECIO_GALLINA)
			{
				if (IsPlayerAlive(client))
				{
					SetEntityModel(client, "models/chicken/chicken.mdl");
					SetEntPropFloat(client, Prop_Data, "m_flModelScale", 1.5);
					SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.3);					
					g_iCredits[client] -= PRECIO_GALLINA;
					PrintToChat(client, "\x04[RAGE Awards] \x05Te Convertiste en una Gallina! Tus Creditos: %i (%i)", g_iCredits[client], PRECIO_GALLINA);
				}
				else
				{
					PrintToChat(client, "\x04[RAGE Awards] \x05Tienes que estar vivo para Comprar");
				}
			}
			else
			{
				PrintToChat(client, "\x04[RAGE Awards] \x05Tus Creditos: %i (No tienes Suficientes Creditos! Necesitas %i)", g_iCredits[client], PRECIO_GALLINA);
			}            
        }
		else if ( strcmp(info,"option_pajaro") == 0 ) 
        {
			DID(client);
			if (g_iCredits[client] >= PRECIO_PAJARO)
			{
				if (IsPlayerAlive(client))
				{
					SetEntityMoveType(client, MOVETYPE_FLY);
				  
					if (GetClientTeam(client) == CS_TEAM_CT)
					{
					  SetEntityModel(client, "models/pigeon.mdl");
					}
					else
					{
					  SetEntityModel(client, "models/crow.mdl");
					}
					new wepIdx;

					// strip all weapons
					for (new s = 0; s < 4; s++)
					{
						if ((wepIdx = GetPlayerWeaponSlot(client, s)) != -1)
						{
						 RemovePlayerItem(client, wepIdx);
						 RemoveEdict(wepIdx);
						}
					}
					
					GivePlayerItem(client, "weapon_knife");
					g_Fly[client] = true;
					g_iCredits[client] -= PRECIO_PAJARO;
					PrintToChat(client, "\x04[RAGE Awards] \x05Ahora eres un Pajaro! Tus Creditos: %i (%i)", g_iCredits[client], PRECIO_PAJARO);
				}
				else
				{
					PrintToChat(client, "\x04[RAGE Awards] \x05Tienes que estar Vivo, para Comprar Premios");
				}
			}
			else
			{
				PrintToChat(client, "\x04[RAGE Awards] \x05Tus Creditos: %i (No tienes Suficientes Creditos! Necesitas %i)", g_iCredits[client], PRECIO_PAJARO);
			}            
        }
		else if ( strcmp(info,"option_inmortal") == 0 ) 
        {
			DID(client);
			if (g_iCredits[client] >= PRECIO_INMORTAL)
			{
				if (IsPlayerAlive(client))
				{
					g_Godmode[client] = true;
					SetEntityRenderColor(client, 0, 255, 255, 255);
					SetPlayerInvulnerable(client);
					g_iCredits[client] -= PRECIO_INMORTAL;

					PrintToChat(client, "\x04[RAGE Awards] \x05Ahora eres Inmortal Por 20 Segundos! Tus Creditos: %i (%i)", g_iCredits[client], PRECIO_INMORTAL);
				}
				else
				{
					PrintToChat(client, "\x04[RAGE Awards] \x05Tienes que estar Vivo, para Comprar Premios");
				}
			}
			else
			{
				PrintToChat(client, "\x04[RAGE Awards] \x05Tus Creditos: %i (No Tienes Suficientes Creditos! Necesitas %i)", g_iCredits[client], PRECIO_INMORTAL);
			}            
        }
		else if ( strcmp(info,"option_gallinazombie") == 0 ) 
        {
			DID(client);
			if (g_iCredits[client] >= PRECIO_GALLINAZOMBIE)
			{
				if (IsPlayerAlive(client))
				{
					SetEntityModel(client, "models/chicken/chicken_zombie.mdl");
					SetEntityHealth(client, 300);					
					g_iCredits[client] -= PRECIO_GALLINAZOMBIE;
					PrintToChat(client, "\x04[RAGE Awards] \x05Te Convertiste en una Gallina ZOMBIE! Tus Creditos: %i (%i)", g_iCredits[client], PRECIO_GALLINAZOMBIE);
				}
				else
				{
					PrintToChat(client, "\x04[RAGE Awards] \x05Tienes que estar vivo para Comprar");
				}
			}
			else
			{
				PrintToChat(client, "\x04[RAGE Awards] \x05Tus Creditos: %i (No tienes Suficientes Creditos! Necesitas %i)", g_iCredits[client], PRECIO_GALLINAZOMBIE);
			}
        }
		else if ( strcmp(info,"option_invisible") == 0 ) 
        {
			DID(client);
			if (g_iCredits[client] >= PRECIO_INVISIBLE)
			{
				if (IsPlayerAlive(client))
				{
					SetPlayerInvisible(client);
					invisiblePlayers[client] = 1;
					g_iCredits[client] -= PRECIO_INVISIBLE;

					PrintToChat(client, "\x04[RAGE Awards] \x05Eres invisible por 10 segundos! Tus Creditos: %i (%i)", g_iCredits[client], PRECIO_INVISIBLE);
				}
				else
				{
					PrintToChat(client, "\x04[RAGE Awards] \x05Tienes que estar vivo para Comprar");
				}
			}
			else
			{
				PrintToChat(client, "\x04[RAGE Awards] \x05Tus Creditos: %i (No tienes Suficientes Creditos! Necesitas %i)", g_iCredits[client], PRECIO_INVISIBLE);
			}
        }
		else if ( strcmp(info,"option_fideo") == 0 )
		{
			DID(client);
			if (g_iCredits[client] >= PRECIO_FIDEO)
			{
				if (IsPlayerAlive(client))
				{
					SetEntPropFloat(client, Prop_Data, "m_flModelScale", 0.7);
					g_iCredits[client] -= PRECIO_FIDEO;

					PrintToChat(client, "\x04[RAGE Awards] \x05Te Fideo Di Maria! Tus Creditos: %i (%i)", g_iCredits[client], PRECIO_FIDEO);
				}
				else
				{
					PrintToChat(client, "\x04[RAGE Awards] \x05Tienes que estar vivo para Comprar");
				}
			}
			else
			{
				PrintToChat(client, "\x04[RAGE Awards] \x05Tus Creditos: %i (No tienes Suficientes Creditos! Necesitas %i)", g_iCredits[client], PRECIO_FIDEO);
			}
		}
		else if ( strcmp(info,"option_fideodimaria") == 0 )
		{
			DID(client);
			if (g_iCredits[client] >= PRECIO_FIDEODIMARIA)
			{
				if (IsPlayerAlive(client))
				{
					SetEntPropFloat(client, Prop_Data, "m_flModelScale", 0.7);
					SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.3);					
					g_iCredits[client] -= PRECIO_FIDEODIMARIA;

					PrintToChat(client, "\x04[RAGE Awards] \x05Te Fideo Di Maria! Tus Creditos: %i (%i)", g_iCredits[client], PRECIO_FIDEODIMARIA);
				}
				else
				{
					PrintToChat(client, "\x04[RAGE Awards] \x05Tienes que estar vivo para Comprar");
				}
			}
			else
			{
				PrintToChat(client, "\x04[RAGE Awards] \x05Tus Creditos: %i (No tienes Suficientes Creditos! Necesitas %i)", g_iCredits[client], PRECIO_FIDEODIMARIA);
			}
		}		
		/*else if ( strcmp(info,"option16") == 0 ) 
        {
			DID(client);
			if (g_iCredits[client] >= 1)
			{
			   if (IsPlayerAlive(client))
			   {

				  GivePlayerItem(client, "c4");

				  g_iCredits[client] -= 1;

				  PrintToChat(client, "\x04[RAGE Awards] \x05Ahora Tienes un C4! Tus Creditos: %i (-1)", g_iCredits[client]);
			   }
			   else
			   {
				  PrintToChat(client, "\x04[RAGE Awards] \x05Tienes que estar Vivo, para Comprar Premios");
			   }

			}
			else
			{
			 PrintToChat(client, "\x04[RAGE Awards] \x05Tus Creditos: %i (No tienes Suficientes Creditos! Necesitas 1)", g_iCredits[client]);
			}            
        }
		else if ( strcmp(info,"option17") == 0 ) 
		{
			DID(client);
			PrintToChat(client, "\x04[RAGE Awards] \x05Sus Creditos Actuales son: %i", g_iCredits[client]);          
		}*/
    }
}

public Action:FijarCreditos(client, args)
{
    if(client == 0)
    {
		PrintToServer("%t","Command is in-game only");
		return Plugin_Handled;
    }

    if(args < 2) // Not enough parameters
    {
		ReplyToCommand(client, "[SM] Use: sm_setcredits <#userid|name> [amount]");
		return Plugin_Handled;
    }

    decl String:arg2[10];
    //GetCmdArg(1, arg, sizeof(arg));
    GetCmdArg(2, arg2, sizeof(arg2));

    new amount = StringToInt(arg2);
    //new target;

    //decl String:patt[MAX_NAME]

    //if(args == 1) 
    //{ 
    decl String:strTarget[32]; GetCmdArg(1, strTarget, sizeof(strTarget)); 

    // Process the targets 
    decl String:strTargetName[MAX_TARGET_LENGTH]; 
    decl TargetList[MAXPLAYERS], TargetCount; 
    decl bool:TargetTranslate; 

    if ((TargetCount = ProcessTargetString(strTarget, client, TargetList, MAXPLAYERS, COMMAND_FILTER_CONNECTED, 
                                           strTargetName, sizeof(strTargetName), TargetTranslate)) <= 0) 
    { 
		ReplyToTargetError(client, TargetCount); 
		return Plugin_Handled; 
    } 

    // Apply to all targets 
    for (new i = 0; i < TargetCount; i++) 
    { 
		new iClient = TargetList[i]; 
		if (IsClientInGame(iClient)) 
		{ 
			g_iCredits[iClient] = amount;
			PrintToChat(client, "\x04[RAGE Awards] \x05Es %i el monto actual de %N", amount, iClient);
		} 
    } 
    //}  

//    SetEntProp(target, Prop_Data, "m_iDeaths", amount);
    return Plugin_Continue;
}


public Action:ResetAmmo(Handle:timer)
{
	for (new client = 1; client <= MaxClients; client++)
	{
		if (IsClientConnected(client) && !IsFakeClient(client) && IsClientInGame(client) && IsPlayerAlive(client) && (g_AmmoInfi[client]))
		{
			Client_ResetAmmo(client);
		}
	}
}

public Client_ResetAmmo(client)
{
	new zomg = GetEntDataEnt2(client, activeOffset);
	if (clip1Offset != -1 && zomg != -1)
		SetEntData(zomg, clip1Offset, 200, 4, true);
	if (clip2Offset != -1 && zomg != -1)
		SetEntData(zomg, clip2Offset, 200, 4, true);
	if (priAmmoTypeOffset != -1 && zomg != -1)
		SetEntData(zomg, priAmmoTypeOffset, 200, 4, true);
	if (secAmmoTypeOffset != -1 && zomg != -1)
		SetEntData(zomg, secAmmoTypeOffset, 200, 4, true);
}


public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
      if (g_Godmode[victim])
      {
               damage = 0.0;
               return Plugin_Changed;
      }
      return Plugin_Continue;
}

public Action:OnWeaponCanUse(client, weapon)
{
	if (g_Fly[client])
	{
		decl String:sClassname[32];
		GetEdictClassname(weapon, sClassname, sizeof(sClassname));
		if (!StrEqual(sClassname, "weapon_knife"))
			return Plugin_Handled;
	}
	return Plugin_Continue;
}

public OnClientPutInServer(client)
{
	SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
	SDKHook(client, SDKHook_WeaponCanUse, OnWeaponCanUse);
}

public OnClientPostAdminCheck(client)
{
    g_Godmode[client] = false;
    g_Fly[client] = false;
    g_AmmoInfi[client] = false;
}

public Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));

	if (GetClientTeam(client) == 1 && !IsPlayerAlive(client))
	{
		return;
	}

	CreateTimer(1.0, MensajesSpawn, client);

	if (g_Fly[client])
	{
		g_Fly[client] = false;
		SetEntityMoveType(client, MOVETYPE_WALK);
	}
	if (g_Godmode[client])
	{
		g_Godmode[client] = false;
	}
	if (g_AmmoInfi[client])
	{
		g_AmmoInfi[client] = false;
	}
	if (GetEntPropFloat(client, Prop_Data, "m_flModelScale") != 1.0)
	{
		SetEntPropFloat(client, Prop_Data, "m_flModelScale", 1.0);
	}
}

public SetPlayerInvisible(client)
{
	SetEntityRenderMode(client, RENDER_TRANSCOLOR);
	SetEntityRenderColor(client, 255, 255, 255, 10);
	CreateTimer(10.0, SetPlayerVisible, GetClientUserId(client));
}

public Action:SetPlayerVisible(Handle:timer, any:clientId)
{
	new client = GetClientOfUserId(clientId);
	if(IsValidClient(client) && IsPlayerAlive(client))
	{
		SetEntityRenderMode(client, RENDER_TRANSCOLOR);
		SetEntityRenderColor(client, 255, 255, 255, 255);
		return Plugin_Continue;
	}
	return Plugin_Continue;
}

public SetPlayerInvulnerable(client)
{
	if(IsValidClient(client) && IsPlayerAlive(client))
	{
		SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.0);
		PrintToChat(client, "\x04[RAGE Awards] \x05Tienes 10 segundos de invulnerabilidad!");
		CreateTimer(10.0, SetPlayerVulnerable, GetClientUserId(client));
	}
}

public Action:SetPlayerVulnerable(Handle:timer, any:clientId)
{
	new client = GetClientOfUserId(clientId);
	if(IsValidClient(client) && IsPlayerAlive(client))
	{
		SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.0);
		PrintToChat(client, "\x04[RAGE Awards] \x05Eres mortal nuevamente!");
		g_Godmode[client] = false;
		SetEntityRenderColor(client, 255, 255, 255, 255);
		return Plugin_Continue;
	}
	return Plugin_Continue;
}

stock bool:IsValidClient(client, bool:nobots = true)
{ 
    if (client <= 0 || client > MaxClients || !IsClientConnected(client) || (nobots && IsFakeClient(client)))
    {
        return false; 
    }
    return IsClientInGame(client); 
}

Last edited by NanoC; 08-21-2018 at 12:27.
NanoC is online now
Reply


Thread Tools
Display Modes

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 11:48.


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