Advertisement
neatekFb

SourcePawn - use command args - Lesson #2

Mar 22nd, 2018
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.52 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3.  
  4. public OnPluginStart()
  5. {
  6.     RegAdminCmd("sm_sethp", sm_sethp, ADMFLAG_ROOT);
  7. }
  8.  
  9. // sm_sethp <userid> <health>
  10. public Action:sm_sethp(int client, int args)
  11. {
  12.     char userid[86]; // use userid from console 'status'
  13.     char health[86];
  14.     GetCmdArg(1, userid, sizeof(userid));
  15.     GetCmdArg(2, health, sizeof(health));
  16.     // must be check if valid player (alive etc.) its very important..
  17.     SetEntityHealth(GetClientOfUserId(StringToInt(userid)), StringToInt(health));
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement