Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #define CO_ORANGE 0xFF9900AA
- #define CO_YELLOW 0xFFFF00FF
- #define CO_RED 0xFF0000FF
- new bool:godmode[MAX_PLAYERS];
- new Text3D:godtext[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("\n-------------------------------------------------------");
- print(" God Mode v1.0 by dEcooR was successfully loaded.. ");
- print("-------------------------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- godmode[playerid] = false;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- godmode[playerid] = false;
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- godmode[playerid] = false;
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- new Float:hp,Float:arm;
- GetPlayerHealth(playerid,hp);
- GetPlayerArmour(playerid,arm);
- if(godmode[playerid] == true)
- {
- if(hp < 99.0) SetPlayerHealth(playerid, 100.0);
- if(arm < 99.0) SetPlayerArmour(playerid, 100.0);
- }
- else if(godmode[playerid] == false) return 1;
- return 1;
- }
- CMD:godmode(playerid, params[])
- {
- new oo[10],id,string[128];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, CO_RED, "You are not the administrator !"); // You can change it ;)
- else if(sscanf(params, "us", id,oo)) return SendClientMessage(playerid, CO_RED, "Command: /godmode [ Player ID ] [ On / Off ]");
- else if(!IsPlayerConnected(id)) return SendClientMessage(playerid, CO_RED, "Wrong playerid!");
- else
- {
- if(strcmp(oo, "on", true) ==0)
- {
- if(godmode[id] == true) return SendClientMessage(playerid,CO_RED,"Player have already turned on GodMode.");
- else
- {
- format(string, sizeof(string), "Administrator %s has turned on GodMode for player %s.", PlayerName(playerid),PlayerName(id));
- SendClientMessageToAll(CO_YELLOW, string);
- format(string, sizeof(string), "Your health is now unlimted by administrator %s.", PlayerName(playerid));
- SendClientMessage(id,CO_ORANGE, string);
- godmode[id] = true;
- PlayerPlaySound(id, 1057, 0, 0, 0);
- GameTextForPlayer(playerid,"~r~]GOD MODE ~g~ACTIVATED",4100,3);
- godtext[playerid] = Create3DTextLabel("• GOD MODE ACTIVATED •",CO_RED,30.0,40.0,50.0,40.0,0);
- Attach3DTextLabelToPlayer(godtext[playerid], playerid, 0.0, 0.0, 0.7);
- }
- }
- else if(strcmp(oo, "off", true) ==0)
- {
- if(godmode[id] == false) return SendClientMessage(playerid,CO_RED,"Player have already turned off GodMode.");
- else
- {
- format(string, sizeof(string), "Administrator %s has turned off GodMode for player %s.", PlayerName(playerid),PlayerName(id));
- SendClientMessageToAll(CO_YELLOW, string);
- format(string, sizeof(string), "Your health is now 100 as other gangster by administrator %s.", PlayerName(playerid));
- SendClientMessage(id,CO_ORANGE, string);
- godmode[id] = false;
- PlayerPlaySound(id, 1056, 0, 0, 0);
- GameTextForPlayer(playerid,"~r~]GOD MODE ~g~DEACTIVATED",4100,3);
- Delete3DTextLabel(Text3D:godtext[playerid]);
- }
- }
- }
- return 1;
- }
- stock PlayerName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- return name;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement