Advertisement
Guest User

Simple GOD MODE

a guest
Jun 13th, 2013
616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.31 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <sscanf2>
  4.  
  5. #define CO_ORANGE 0xFF9900AA
  6. #define CO_YELLOW 0xFFFF00FF
  7. #define CO_RED 0xFF0000FF
  8.  
  9. new bool:godmode[MAX_PLAYERS];
  10. new Text3D:godtext[MAX_PLAYERS];
  11.  
  12. public OnFilterScriptInit()
  13. {
  14.     print("\n-------------------------------------------------------");
  15.     print("     God Mode v1.0 by dEcooR was successfully loaded..   ");
  16.     print("-------------------------------------------------------\n");
  17.     return 1;
  18. }
  19.  
  20. public OnFilterScriptExit()
  21. {
  22.     return 1;
  23. }
  24.  
  25. public OnPlayerConnect(playerid)
  26. {
  27.     godmode[playerid] = false;
  28.     return 1;
  29. }
  30.  
  31. public OnPlayerDisconnect(playerid, reason)
  32. {
  33.     godmode[playerid] = false;
  34.     return 1;
  35. }
  36.  
  37. public OnPlayerDeath(playerid, killerid, reason)
  38. {
  39.     godmode[playerid] = false;
  40.     return 1;
  41. }
  42.  
  43. public OnPlayerUpdate(playerid)
  44. {
  45.     new Float:hp,Float:arm;
  46.     GetPlayerHealth(playerid,hp);
  47.     GetPlayerArmour(playerid,arm);
  48.    
  49.     if(godmode[playerid] == true)
  50.     {
  51.         if(hp < 99.0) SetPlayerHealth(playerid, 100.0);
  52.         if(arm < 99.0) SetPlayerArmour(playerid, 100.0);
  53.     }
  54.     else if(godmode[playerid] == false) return 1;
  55.     return 1;
  56. }
  57.  
  58. CMD:godmode(playerid, params[])
  59. {
  60.     new oo[10],id,string[128];
  61.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, CO_RED, "You are not the administrator !"); // You can change it ;)
  62.     else if(sscanf(params, "us", id,oo)) return SendClientMessage(playerid, CO_RED, "Command: /godmode [ Player ID ] [ On / Off ]");
  63.     else if(!IsPlayerConnected(id)) return SendClientMessage(playerid, CO_RED, "Wrong playerid!");
  64.     else
  65.     {
  66.         if(strcmp(oo, "on", true) ==0)
  67.         {
  68.             if(godmode[id] == true) return SendClientMessage(playerid,CO_RED,"Player have already turned on GodMode.");
  69.             else
  70.             {
  71.                 format(string, sizeof(string), "Administrator %s has turned on GodMode for player %s.", PlayerName(playerid),PlayerName(id));
  72.                 SendClientMessageToAll(CO_YELLOW, string);
  73.  
  74.                 format(string, sizeof(string), "Your health is now unlimted by administrator %s.", PlayerName(playerid));
  75.                 SendClientMessage(id,CO_ORANGE, string);
  76.  
  77.                 godmode[id] = true;
  78.                 PlayerPlaySound(id, 1057, 0, 0, 0);
  79.                
  80.                 GameTextForPlayer(playerid,"~r~]GOD MODE ~g~ACTIVATED",4100,3);
  81.                 godtext[playerid] = Create3DTextLabel("• GOD MODE ACTIVATED •",CO_RED,30.0,40.0,50.0,40.0,0);
  82.                 Attach3DTextLabelToPlayer(godtext[playerid], playerid, 0.0, 0.0, 0.7);
  83.             }
  84.         }
  85.         else if(strcmp(oo, "off", true) ==0)
  86.         {
  87.             if(godmode[id] == false) return SendClientMessage(playerid,CO_RED,"Player have already turned off GodMode.");
  88.             else
  89.             {
  90.                 format(string, sizeof(string), "Administrator %s has turned off GodMode for player %s.", PlayerName(playerid),PlayerName(id));
  91.                 SendClientMessageToAll(CO_YELLOW, string);
  92.  
  93.                 format(string, sizeof(string), "Your health is now 100 as other gangster by administrator %s.", PlayerName(playerid));
  94.                 SendClientMessage(id,CO_ORANGE, string);
  95.  
  96.                 godmode[id] = false;
  97.                 PlayerPlaySound(id, 1056, 0, 0, 0);
  98.                
  99.                 GameTextForPlayer(playerid,"~r~]GOD MODE ~g~DEACTIVATED",4100,3);
  100.                 Delete3DTextLabel(Text3D:godtext[playerid]);
  101.             }
  102.         }
  103.     }
  104.     return 1;
  105. }
  106.  
  107. stock PlayerName(playerid)
  108. {
  109.     new name[MAX_PLAYER_NAME];
  110.     GetPlayerName(playerid,name,sizeof(name));
  111.     return name;
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement