diff --git a/ExtraCommands/scripting/ExtraCommands.sp b/ExtraCommands/scripting/ExtraCommands.sp index 2ce9de32..f02e1c9c 100644 --- a/ExtraCommands/scripting/ExtraCommands.sp +++ b/ExtraCommands/scripting/ExtraCommands.sp @@ -3,6 +3,9 @@ #include #include #include +#include + +#pragma newdecls required bool g_bInBuyZoneAll = false; bool g_bInBuyZone[MAXPLAYERS + 1] = {false, ...}; @@ -14,16 +17,16 @@ bool g_bInfAmmo[MAXPLAYERS + 1] = {false, ...}; ConVar g_CVar_sv_pausable; bool g_bPaused; -public Plugin:myinfo = +public Plugin myinfo = { name = "Advanced Commands", - author = "BotoX", - description = "Adds: hp, kevlar, weapon, strip, buyzone, iammo, speed", - version = "1.0.1", - url = "" + author = "BotoX + Obus", + description = "Adds: hp, kevlar, weapon, strip, buyzone, iammo, speed, respawn and cash commands", + version = "1.1", + url = "https://github.com/CSSZombieEscape/sm-plugins/tree/master/ExtraCommands/" }; -public OnPluginStart() +public void OnPluginStart() { LoadTranslations("common.phrases"); RegAdminCmd("sm_hp", Command_Health, ADMFLAG_GENERIC, "sm_hp <#userid|name> "); @@ -34,19 +37,23 @@ public OnPluginStart() RegAdminCmd("sm_buyzone", Command_BuyZone, ADMFLAG_GENERIC, "sm_buyzone <#userid|name> <0|1>"); RegAdminCmd("sm_iammo", Command_InfAmmo, ADMFLAG_GENERIC, "sm_iammo <#userid|name> <0|1>"); RegAdminCmd("sm_speed", Command_Speed, ADMFLAG_GENERIC, "sm_speed <#userid|name> <0|1>"); + RegAdminCmd("sm_respawn", Command_Respawn, ADMFLAG_GENERIC, "sm_respawn <#userid|name>"); + RegAdminCmd("sm_cash", Command_Cash, ADMFLAG_GENERIC, "sm_cash <#userid|name> "); HookEvent("bomb_planted", Event_BombPlanted, EventHookMode_Pre); HookEvent("bomb_defused", Event_BombDefused, EventHookMode_Pre); g_CVar_sv_pausable = FindConVar("sv_pausable"); + if(g_CVar_sv_pausable) AddCommandListener(Listener_Pause, "pause"); } -public OnMapStart() +public void OnMapStart() { g_bInBuyZoneAll = false; g_bInfAmmoAll = false; + if(g_bInfAmmoHooked) { UnhookEvent("weapon_fire", Event_WeaponFire); @@ -54,7 +61,7 @@ public OnMapStart() } /* Handle late load */ - for(new i = 1; i <= MaxClients; i++) + for(int i = 1; i <= MaxClients; i++) { if(IsClientConnected(i) && IsClientInGame(i)) { @@ -73,27 +80,29 @@ public Action Listener_Pause(int client, const char[] command, int argc) ReplyToCommand(client, "sv_pausable is set to 0!"); return Plugin_Handled; } + if(client == 0) { PrintToServer("[SM] Cannot use command from server console."); return Plugin_Handled; } + if(!IsClientAuthorized(client) || !GetAdminFlag(GetUserAdmin(client), Admin_Generic)) { ReplyToCommand(client, "You do not have permission to pause the game."); return Plugin_Handled; } - ShowActivity2(client, "[SM] ", "%s the game.", g_bPaused ? "Unpaused" : "Paused"); + ShowActivity2(client, "\x01[SM] \x04", "%s\x01 the game.", g_bPaused ? "Unpaused" : "Paused"); LogAction(client, -1, "%s the game.", g_bPaused ? "Unpaused" : "Paused"); g_bPaused = !g_bPaused; return Plugin_Continue; } -public Action:Event_BombPlanted(Handle:event, const String:name[], bool:dontBroadcast) +public Action Event_BombPlanted(Handle event, const char[] name, bool dontBroadcast) { - for(new i = 1; i <= MaxClients; i++) + for(int i = 1; i <= MaxClients; i++) { if(IsClientInGame(i)) ClientCommand(i, "playgamesound \"radio/bombpl.wav\""); @@ -101,9 +110,9 @@ public Action:Event_BombPlanted(Handle:event, const String:name[], bool:dontBroa return Plugin_Handled; } -public Action:Event_BombDefused(Handle:event, const String:name[], bool:dontBroadcast) +public Action Event_BombDefused(Handle event, const char[] name, bool dontBroadcast) { - for(new i = 1; i <= MaxClients; i++) + for(int i = 1; i <= MaxClients; i++) { if(IsClientInGame(i)) ClientCommand(i, "playgamesound \"radio/bombdef.wav\""); @@ -111,15 +120,16 @@ public Action:Event_BombDefused(Handle:event, const String:name[], bool:dontBroa return Plugin_Handled; } -public OnClientPutInServer(client) +public void OnClientPutInServer(int client) { g_bInBuyZone[client] = false; g_bInfAmmo[client] = false; + SDKHook(client, SDKHook_PreThink, OnPreThink); SDKHook(client, SDKHook_PostThinkPost, OnPostThinkPost); } -public OnPreThink(client) +public void OnPreThink(int client) { if(IsClientInGame(client) && IsPlayerAlive(client)) { @@ -127,7 +137,7 @@ public OnPreThink(client) } } -public OnPostThinkPost(client) +public void OnPostThinkPost(int client) { if(IsClientInGame(client) && IsPlayerAlive(client)) { @@ -136,21 +146,21 @@ public OnPostThinkPost(client) } } -public Event_WeaponFire(Handle:hEvent, String:name[], bool:dontBroadcast) +public void Event_WeaponFire(Handle hEvent, char[] name, bool dontBroadcast) { - new client = GetClientOfUserId(GetEventInt(hEvent, "userid")); + int client = GetClientOfUserId(GetEventInt(hEvent, "userid")); if(!g_bInfAmmoAll && !g_bInfAmmo[client]) return; - new weapon = GetEntPropEnt(client, Prop_Data, "m_hActiveWeapon", 0); + int weapon = GetEntPropEnt(client, Prop_Data, "m_hActiveWeapon", 0); if(IsValidEntity(weapon)) { if(weapon == GetPlayerWeaponSlot(client, 0) || weapon == GetPlayerWeaponSlot(client, 1)) { if(GetEntProp(weapon, Prop_Send, "m_iState", 4, 0) == 2 && GetEntProp(weapon, Prop_Send, "m_iClip1", 4, 0)) { - new toAdd = 1; - new String:weaponClassname[128]; + int toAdd = 1; + char weaponClassname[128]; GetEntityClassname(weapon, weaponClassname, sizeof(weaponClassname)); if(StrEqual(weaponClassname, "weapon_glock", true) || StrEqual(weaponClassname, "weapon_famas", true)) @@ -182,119 +192,110 @@ public Event_WeaponFire(Handle:hEvent, String:name[], bool:dontBroadcast) return; } -public Action:Command_Health(client, args) +public Action Command_Health(int client, int argc) { - if(args < 2) + if(argc < 2) { ReplyToCommand(client, "[SM] Usage: sm_hp <#userid|name> "); return Plugin_Handled; } - decl String:arg[65]; + char arg[65]; GetCmdArg(1, arg, sizeof(arg)); - new amount = 0; - decl String:arg2[20]; + int amount = 0; + char arg2[20]; GetCmdArg(2, arg2, sizeof(arg2)); + if(StringToIntEx(arg2, amount) == 0 || amount <= 0) { ReplyToCommand(client, "[SM] Invalid Value"); return Plugin_Handled; } - decl String:target_name[MAX_TARGET_LENGTH]; - decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; + char target_name[MAX_TARGET_LENGTH]; + int target_list[MAXPLAYERS]; + int target_count; + bool tn_is_ml; - if((target_count = ProcessTargetString( - arg, - client, - target_list, - MAXPLAYERS, - COMMAND_FILTER_ALIVE, - target_name, - sizeof(target_name), - tn_is_ml)) <= 0) + if((target_count = ProcessTargetString(arg, client, target_list, MAXPLAYERS, COMMAND_FILTER_ALIVE, target_name, sizeof(target_name), tn_is_ml)) <= 0) { ReplyToTargetError(client, target_count); return Plugin_Handled; } - for(new i = 0; i < target_count; i++) + for(int i = 0; i < target_count; i++) { SetEntProp(target_list[i], Prop_Send, "m_iHealth", amount, 1); } - ShowActivity2(client, "[SM] ", "Set health to %d on target %s", amount, target_name); + ShowActivity2(client, "\x01[SM] \x04", "\x01Set health to \x04%d\x01 on target \x04%s", amount, target_name); return Plugin_Handled; } -public Action:Command_Armor(client, args) +public Action Command_Armor(int client, int argc) { - if(args < 2) + if(argc < 2) { ReplyToCommand(client, "[SM] Usage: sm_armor <#userid|name> "); return Plugin_Handled; } - decl String:arg[65]; + char arg[65]; GetCmdArg(1, arg, sizeof(arg)); - new amount = 0; - decl String:arg2[20]; + int amount = 0; + char arg2[20]; GetCmdArg(2, arg2, sizeof(arg2)); + if(StringToIntEx(arg2, amount) == 0 || amount < 0) { ReplyToCommand(client, "[SM] Invalid Value"); return Plugin_Handled; } - decl String:target_name[MAX_TARGET_LENGTH]; - decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; + char target_name[MAX_TARGET_LENGTH]; + int target_list[MAXPLAYERS]; + int target_count; + bool tn_is_ml; - if((target_count = ProcessTargetString( - arg, - client, - target_list, - MAXPLAYERS, - COMMAND_FILTER_ALIVE, - target_name, - sizeof(target_name), - tn_is_ml)) <= 0) + if((target_count = ProcessTargetString(arg, client, target_list, MAXPLAYERS, COMMAND_FILTER_ALIVE, target_name, sizeof(target_name), tn_is_ml)) <= 0) { ReplyToTargetError(client, target_count); return Plugin_Handled; } - for(new i = 0; i < target_count; i++) + for(int i = 0; i < target_count; i++) { SetEntProp(target_list[i], Prop_Send, "m_ArmorValue", amount, 1); } - ShowActivity2(client, "[SM] ", "Set kevlar to %d on target %s", amount, target_name); + ShowActivity2(client, "\x01[SM] \x04", "\x01Set kevlar to \x04%d\x01 on target \x04%s", amount, target_name); LogAction(client, -1, "Set kevlar to %d on target %s", amount, target_name); return Plugin_Handled; } -public Action:Command_Weapon(client, args) +public Action Command_Weapon(int client, int argc) { - if(args < 2) + if(argc < 2) { ReplyToCommand(client, "[SM] Usage: sm_weapon <#userid|name> [clip] [ammo]"); return Plugin_Handled; } - new ammo = 2500; - new clip = -1; + int ammo = 2500; + int clip = -1; - decl String:arg[65]; + char arg[65]; GetCmdArg(1, arg, sizeof(arg)); - decl String:arg2[65]; + char arg2[65]; GetCmdArg(2, arg2, sizeof(arg2)); - decl String:weapon[65]; + char weapon[65]; + if(strncmp(arg2, "weapon_", 7) != 0 && strncmp(arg2, "item_", 5) != 0 && !StrEqual(arg2, "nvg", false)) Format(weapon, sizeof(weapon), "weapon_%s", arg2); else @@ -303,8 +304,8 @@ public Action:Command_Weapon(client, args) if(StrContains(weapon, "grenade", false) != -1 || StrContains(weapon, "flashbang", false) != -1 || strncmp(arg2, "item_", 5) == 0) ammo = -1; - new AdminId:id = GetUserAdmin(client); - new superadmin = GetAdminFlag(id, Admin_Custom3); + AdminId id = GetUserAdmin(client); + int superadmin = GetAdminFlag(id, Admin_Custom3); if(!superadmin) { @@ -315,20 +316,23 @@ public Action:Command_Weapon(client, args) } } - if(args >= 3) + if(argc >= 3) { - decl String:arg3[20]; + char arg3[20]; GetCmdArg(3, arg3, sizeof(arg3)); + if(StringToIntEx(arg3, clip) == 0) { ReplyToCommand(client, "[SM] Invalid Clip Value"); return Plugin_Handled; } } - if(args >= 4) + + if(argc >= 4) { - decl String:arg4[20]; + char arg4[20]; GetCmdArg(4, arg4, sizeof(arg4)); + if(StringToIntEx(arg4, ammo) == 0) { ReplyToCommand(client, "[SM] Invalid Ammo Value"); @@ -338,23 +342,17 @@ public Action:Command_Weapon(client, args) if(StrContains(weapon, "grenade", false) != -1 || StrContains(weapon, "flashbang", false) != -1) { - new tmp = ammo; + int tmp = ammo; ammo = clip; clip = tmp; } - decl String:target_name[MAX_TARGET_LENGTH]; - decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; + char target_name[MAX_TARGET_LENGTH]; + int target_list[MAXPLAYERS]; + int target_count; + bool tn_is_ml; - if((target_count = ProcessTargetString( - arg, - client, - target_list, - MAXPLAYERS, - COMMAND_FILTER_ALIVE, - target_name, - sizeof(target_name), - tn_is_ml)) <= 0) + if((target_count = ProcessTargetString(arg, client, target_list, MAXPLAYERS, COMMAND_FILTER_ALIVE, target_name, sizeof(target_name), tn_is_ml)) <= 0) { ReplyToTargetError(client, target_count); return Plugin_Handled; @@ -362,19 +360,19 @@ public Action:Command_Weapon(client, args) if(StrEqual(weapon, "nvg", false)) { - for(new i = 0; i < target_count; i++) + for(int i = 0; i < target_count; i++) SetEntProp(target_list[i], Prop_Send, "m_bHasNightVision", 1, 1); } else if(StrEqual(weapon, "item_defuser", false)) { - for(new i = 0; i < target_count; i++) + for(int i = 0; i < target_count; i++) SetEntProp(target_list[i], Prop_Send, "m_bHasDefuser", 1); } else { - for(new i = 0; i < target_count; i++) + for(int i = 0; i < target_count; i++) { - new ent = GivePlayerItem(target_list[i], weapon); + int ent = GivePlayerItem(target_list[i], weapon); if(ent == -1) { ReplyToCommand(client, "[SM] Invalid Weapon"); @@ -386,7 +384,8 @@ public Action:Command_Weapon(client, args) if(ammo != -1) { - new PrimaryAmmoType = GetEntProp(ent, Prop_Data, "m_iPrimaryAmmoType"); + int PrimaryAmmoType = GetEntProp(ent, Prop_Data, "m_iPrimaryAmmoType"); + if(PrimaryAmmoType != -1) SetEntProp(target_list[i], Prop_Send, "m_iAmmo", ammo, _, PrimaryAmmoType); } @@ -396,52 +395,48 @@ public Action:Command_Weapon(client, args) if(ammo != -1) { - new PrimaryAmmoType = GetEntProp(ent, Prop_Data, "m_iPrimaryAmmoType"); + int PrimaryAmmoType = GetEntProp(ent, Prop_Data, "m_iPrimaryAmmoType"); + if(PrimaryAmmoType != -1) SetEntProp(target_list[i], Prop_Send, "m_iAmmo", ammo, _, PrimaryAmmoType); } } } - ShowActivity2(client, "[SM] ", "Gave %s to target %s", weapon, target_name); + ShowActivity2(client, "\x01[SM] \x04", "\x01Gave \x04%s\x01 to target \x04%s", weapon, target_name); LogAction(client, -1, "Gave %s to target %s", weapon, target_name); return Plugin_Handled; } -public Action:Command_Strip(client, args) +public Action Command_Strip(int client, int argc) { - if(args < 1) + if(argc < 1) { ReplyToCommand(client, "[SM] Usage: sm_strip <#userid|name>"); return Plugin_Handled; } - decl String:arg[65]; + char arg[65]; GetCmdArg(1, arg, sizeof(arg)); - decl String:target_name[MAX_TARGET_LENGTH]; - decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; + char target_name[MAX_TARGET_LENGTH]; + int target_list[MAXPLAYERS]; + int target_count; + bool tn_is_ml; - if((target_count = ProcessTargetString( - arg, - client, - target_list, - MAXPLAYERS, - COMMAND_FILTER_ALIVE, - target_name, - sizeof(target_name), - tn_is_ml)) <= 0) + if((target_count = ProcessTargetString(arg, client, target_list, MAXPLAYERS, COMMAND_FILTER_ALIVE, target_name, sizeof(target_name), tn_is_ml)) <= 0) { ReplyToTargetError(client, target_count); return Plugin_Handled; } - for(new i = 0; i < target_count; i++) + for(int i = 0; i < target_count; i++) { - for(new j = 0; j < 5; j++) + for(int j = 0; j < 5; j++) { - new w = -1; + int w = -1; + while ((w = GetPlayerWeaponSlot(target_list[i], j)) != -1) { if(IsValidEntity(w)) @@ -450,33 +445,34 @@ public Action:Command_Strip(client, args) } } - ShowActivity2(client, "[SM] ", "Stripped all weapons on target %s", target_name); + ShowActivity2(client, "\x01[SM] \x04", "\x01Stripped all weapons on target \x04%s", target_name); LogAction(client, -1, "Stripped all weapons on target %s", target_name); return Plugin_Handled; } -public Action:Command_BuyZone(client, args) +public Action Command_BuyZone(int client, int argc) { - if(args < 2) + if(argc < 2) { ReplyToCommand(client, "[SM] Usage: sm_buyzone <#userid|name> <0|1>"); return Plugin_Handled; } - decl String:arg[65]; + char arg[65]; GetCmdArg(1, arg, sizeof(arg)); - new value = -1; - decl String:arg2[20]; + int value = -1; + char arg2[20]; GetCmdArg(2, arg2, sizeof(arg2)); + if(StringToIntEx(arg2, value) == 0) { ReplyToCommand(client, "[SM] Invalid Value"); return Plugin_Handled; } - decl String:target_name[MAX_TARGET_LENGTH]; + char target_name[MAX_TARGET_LENGTH]; if(StrEqual(arg, "@all", false)) { @@ -485,55 +481,50 @@ public Action:Command_BuyZone(client, args) } else { - decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; + int target_list[MAXPLAYERS]; + int target_count; + bool tn_is_ml; - if((target_count = ProcessTargetString( - arg, - client, - target_list, - MAXPLAYERS, - COMMAND_FILTER_ALIVE, - target_name, - sizeof(target_name), - tn_is_ml)) <= 0) + if((target_count = ProcessTargetString(arg, client, target_list, MAXPLAYERS, COMMAND_FILTER_ALIVE, target_name, sizeof(target_name), tn_is_ml)) <= 0) { ReplyToTargetError(client, target_count); return Plugin_Handled; } - for(new i = 0; i < target_count; i++) + for(int i = 0; i < target_count; i++) { g_bInBuyZone[target_list[i]] = value ? true : false; } } - ShowActivity2(client, "[SM] ", "%s permanent buyzone on target %s", (value ? "Enabled" : "Disabled"), target_name); + ShowActivity2(client, "\x01[SM] \x04", "%s\x01 permanent buyzone on target \x04%s", (value ? "Enabled" : "Disabled"), target_name); LogAction(client, -1, "%s permanent buyzone on target %s", (value ? "Enabled" : "Disabled"), target_name); return Plugin_Handled; } -public Action:Command_InfAmmo(client, args) +public Action Command_InfAmmo(int client, int argc) { - if(args < 2) + if(argc < 2) { ReplyToCommand(client, "[SM] Usage: sm_iammo <#userid|name> <0|1>"); return Plugin_Handled; } - decl String:arg[65]; + char arg[65]; GetCmdArg(1, arg, sizeof(arg)); - new value = -1; - decl String:arg2[20]; + int value = -1; + char arg2[20]; GetCmdArg(2, arg2, sizeof(arg2)); + if(StringToIntEx(arg2, value) == 0) { ReplyToCommand(client, "[SM] Invalid Value"); return Plugin_Handled; } - decl String:target_name[MAX_TARGET_LENGTH]; + char target_name[MAX_TARGET_LENGTH]; if(StrEqual(arg, "@all", false)) { @@ -542,35 +533,29 @@ public Action:Command_InfAmmo(client, args) if(!g_bInfAmmoAll) { - for(new i = 0; i < MAXPLAYERS; i++) + for(int i = 0; i < MAXPLAYERS; i++) g_bInfAmmo[i] = false; } } else { - decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; + int target_list[MAXPLAYERS]; + int target_count; + bool tn_is_ml; - if((target_count = ProcessTargetString( - arg, - client, - target_list, - MAXPLAYERS, - COMMAND_FILTER_ALIVE, - target_name, - sizeof(target_name), - tn_is_ml)) <= 0) + if((target_count = ProcessTargetString(arg, client, target_list, MAXPLAYERS, COMMAND_FILTER_ALIVE, target_name, sizeof(target_name), tn_is_ml)) <= 0) { ReplyToTargetError(client, target_count); return Plugin_Handled; } - for(new i = 0; i < target_count; i++) + for(int i = 0; i < target_count; i++) { g_bInfAmmo[target_list[i]] = value ? true : false; } } - ShowActivity2(client, "[SM] ", "%s infinite ammo on target %s", (value ? "Enabled" : "Disabled"), target_name); + ShowActivity2(client, "\x01[SM] \x04", "%s\x01 infinite ammo on target \x04%s", (value ? "Enabled" : "Disabled"), target_name); LogAction(client, -1, "%s infinite ammo on target %s", (value ? "Enabled" : "Disabled"), target_name); if(g_bInfAmmoAll) @@ -580,10 +565,11 @@ public Action:Command_InfAmmo(client, args) HookEvent("weapon_fire", Event_WeaponFire); g_bInfAmmoHooked = true; } + return Plugin_Handled; } - for(new i = 0; i < MAXPLAYERS; i++) + for(int i = 0; i < MAXPLAYERS; i++) { if(g_bInfAmmo[i]) { @@ -592,6 +578,7 @@ public Action:Command_InfAmmo(client, args) HookEvent("weapon_fire", Event_WeaponFire); g_bInfAmmoHooked = true; } + return Plugin_Handled; } } @@ -605,50 +592,121 @@ public Action:Command_InfAmmo(client, args) return Plugin_Handled; } -public Action:Command_Speed(client, args) +public Action Command_Speed(int client, int argc) { - if(args < 2) + if(argc < 2) { ReplyToCommand(client, "[SM] Usage: sm_speed <#userid|name> "); return Plugin_Handled; } - decl String:arg[65]; + char arg[65]; GetCmdArg(1, arg, sizeof(arg)); - new Float:speed = 0.0; - decl String:arg2[20]; + float speed = 0.0; + char arg2[20]; GetCmdArg(2, arg2, sizeof(arg2)); + if(StringToFloatEx(arg2, speed) == 0 || speed <= 0.0) { ReplyToCommand(client, "[SM] Invalid Value"); return Plugin_Handled; } - decl String:target_name[MAX_TARGET_LENGTH]; - decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml; + char target_name[MAX_TARGET_LENGTH]; + int target_list[MAXPLAYERS]; + int target_count; + bool tn_is_ml; - if((target_count = ProcessTargetString( - arg, - client, - target_list, - MAXPLAYERS, - COMMAND_FILTER_ALIVE, - target_name, - sizeof(target_name), - tn_is_ml)) <= 0) + if((target_count = ProcessTargetString(arg, client, target_list, MAXPLAYERS, COMMAND_FILTER_ALIVE, target_name, sizeof(target_name), tn_is_ml)) <= 0) { ReplyToTargetError(client, target_count); return Plugin_Handled; } - for(new i = 0; i < target_count; i++) + for(int i = 0; i < target_count; i++) { SetEntPropFloat(target_list[i], Prop_Data, "m_flLaggedMovementValue", speed); } - ShowActivity2(client, "[SM] ", "Set speed to %.2f on target %s", speed, target_name); + ShowActivity2(client, "\x01[SM] \x04", "\x01Set speed to \x04%.2f\x01 on target \x04%s", speed, target_name); LogAction(client, -1, "Set speed to %.2f on target %s", speed, target_name); return Plugin_Handled; } + +public Action Command_Respawn(int client, int argc) +{ + if(argc < 1) + { + ReplyToCommand(client, "[SM] Usage: sm_respawn <#userid|name>"); + return Plugin_Handled; + } + + char sArgs[64]; + char sTargetName[MAX_TARGET_LENGTH]; + int iTargets[MAXPLAYERS]; + int iTargetCount; + bool bIsML; + bool bDidRespawn; + + GetCmdArg(1, sArgs, sizeof(sArgs)); + + if ((iTargetCount = ProcessTargetString(sArgs, client, iTargets, MAXPLAYERS, COMMAND_FILTER_DEAD, sTargetName, sizeof(sTargetName), bIsML)) <= 0) + { + ReplyToTargetError(client, iTargetCount); + return Plugin_Handled; + } + + for (int i = 0; i < iTargetCount; i++) + { + if(GetClientTeam(iTargets[i]) == CS_TEAM_SPECTATOR) + continue; + + bDidRespawn = true; + CS_RespawnPlayer(iTargets[i]); + } + + if (bDidRespawn) + { + ShowActivity2(client, "\x01[SM] \x04", "\x01Respawned \x04%s", sTargetName); + LogAction(client, -1, "Respawned %s", sTargetName); + } + + return Plugin_Handled; +} + +public Action Command_Cash(int client, int argc) +{ + if(argc < 2) + { + ReplyToCommand(client, "[SM] Usage: sm_cash <#userid|name> "); + return Plugin_Handled; + } + + char sArgs[64]; + char sArgs2[32]; + char sTargetName[MAX_TARGET_LENGTH]; + int iTargets[MAXPLAYERS]; + int iTargetCount; + bool bIsML; + + GetCmdArg(1, sArgs, sizeof(sArgs)); + GetCmdArg(2, sArgs2, sizeof(sArgs2)); + + if ((iTargetCount = ProcessTargetString(sArgs, client, iTargets, MAXPLAYERS, COMMAND_FILTER_NO_BOTS, sTargetName, sizeof(sTargetName), bIsML)) <= 0) + { + ReplyToTargetError(client, iTargetCount); + return Plugin_Handled; + } + + for (int i = 0; i < iTargetCount; i++) + { + SetEntProp(iTargets[i], Prop_Send, "m_iAccount", StringToInt(sArgs2)); + } + + ShowActivity2(client, "\x01[SM] \x04", "\x01Set \x04%s\x01's cash to \x04%i", sTargetName, StringToInt(sArgs2)); + LogAction(client, -1, "Set %s's cash to %i", sTargetName, StringToInt(sArgs2)); + + return Plugin_Handled; +}