Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- public OnPluginStart()
- {
- RegAdminCmd("sm_sethp", sm_sethp, ADMFLAG_ROOT);
- }
- // sm_sethp <userid> <health>
- public Action:sm_sethp(int client, int args)
- {
- char userid[86]; // use userid from console 'status'
- char health[86];
- GetCmdArg(1, userid, sizeof(userid));
- GetCmdArg(2, health, sizeof(health));
- int target = GetClientOfUserId(StringToInt(userid));
- if(Client_IsValid(target) && IsPlayerAlive(target)) {
- SetEntityHealth(target, StringToInt(health));
- }
- }
- stock bool:Client_IsValid(client, bool:checkConnected=true)
- {
- if (client > 4096) {
- client = EntRefToEntIndex(client);
- }
- if (client < 1 || client > MaxClients) {
- return false;
- }
- if (checkConnected && !IsClientConnected(client)) {
- return false;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement