09.11.2014, 16:01
(
Последний раз редактировалось HY; 09.11.2014 в 16:55.
)
Setting GodMode to a player :
[UNIQUE]
[UNIQUE]
• Hello, I was bored, so I decided to make a /SetGodMode command tutorial.
• What is this?
• Answer: It's a command, wich will sets to a player GodMode [Infinity Life]
• I think this command it's unique, because I never seen this before.
Starting :
pawn Код:
CMD:setgodmode(playerid,params[]) // This it's our command made with ZCMD ;
// ZCMD = A command processor made by Zeex [Thanks Zeex]
{ // We open brackelet !
new ID; // Making a Variable for ID. Wich represent the PlayerID of that player !
if(IsPlayerAdmin(playerid)) // This it's the Admin Variable. This is a variable for RCON Admin ;
// So you need first to log in as RCON, before using this command.
// Or change with your Admin Variable.
{ // Open second brackelet, before your admin variable !
if(sscanf(params,"i", ID)) return SendClientMessage(playerid,-1,"{FF0000}AdmUsage: {15FF00}/SetGodMode [PlayerID]"); // If he makes something wrong, only /SetGodMode, will show to him Usage.
SetPlayerHealth(ID, 10000000); // Will sets to specified player GodMode. [100000000 Life]
SendClientMessage(playerid, -1, "{FF0000}AdmCmd: {15FF00}You gave Infinity Life {FFFF00}[GODMODE] {15FF00}to specified player !"); // This will saw the Admin wich gonna sets GodMode to a player !
SendClientMessage(ID, -1, "{FF0000}AdmCmd: {15FF00}You received Infinity Life {FFFF00}[GODMODE] {15FF00}from Administrator !"); // This will saw player, wich Admin sets to it God Mode
} // Closing brackelet !
else // Else, if he use that command again on that player, will sets 100 life !
{ // Open brackelet
SetPlayerHealth(ID, 100); // Will sets to that player 100 life, for second use.
SendClientMessage(playerid, -1, "{FF0000}AdmCmd: {15FF00}You player's Infinity Life {FFFF00}[GODMODE] [15FF00}!"); // This will saw the Admin wich writes second time /SetGodMode [ID]
SendClientMessage(ID, -1, "{FF0000}AdmCmd: {15FF00}You don't have GodMode now !"); // This will saw the player !
}
return 1; // We need to return 1, else we will get errors.
} // And we close the last brackelet.
/*
After you did this, your command will works.
It's a simple command, but unique.
*/
All code :
pawn Код:
#include <a_samp>
#include <zcmd>
CMD:setgodmode(playerid,params[])
{
new ID;
if(PlayerInfo[playerid][Admin] >= 2)
{
if(sscanf(params,"i", ID)) return SendClientMessage(playerid,-1,"{FF0000}AdmUsage: {15FF00}/SetGodMode [PlayerID]");
SetPlayerHealth(ID, 10000000);
SendClientMessage(playerid, -1, "{FF0000}AdmCmd: {15FF00}You gave Infinity Life {FFFF00}[GODMODE] {15FF00}to specified player !");
SendClientMessage(ID, -1, "{FF0000}AdmCmd: {15FF00}You received Infinity Life {FFFF00}[GODMODE] {15FF00}from Administrator !");
}
else
{
SetPlayerHealth(ID, 100);
SendClientMessage(playerid, -1, "{FF0000}AdmCmd: {15FF00}You player's Infinity Life {FFFF00}[GODMODE] [15FF00}!");
SendClientMessage(ID, -1, "{FF0000}AdmCmd: {15FF00}You don't have GodMode now !");
}
return 1;
}