CMD:kick(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
new PID, pName[MAX_PLAYER_NAME], Sender[MAX_PLAYER_NAME], Str;
if(sscanf(params, "us[128]", PID, params)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]");
if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
Kick(PID);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
}
return 1;
}
CMD:god(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
SetPlayerHealth(playerid, 10000000);
SetPlayerArmour(playerid, 10000000);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
}
return 1;
}
CMD:teleport(playerid, params[])
{
if(IsPlayerAdmin)
{
new ID;
new Str[64];
if(sscanf(params, "u", ID)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /goto [playerid]");
else if(IsPlayerConnected(ID) == 0) SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
else
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(ID, x+1, y+1, z);
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
}
return 1;
}
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin])
{
Originally Posted by Someone
SetPlayerHealth(playerid, 10000000);
|
#define INFINITY 10000000 //This goes to top of script
CMD:god(playerid, params[]) //Defining the command name (requires ZCMD)
{
if(IsPlayerAdmin(playerid)) //Checking if player is RCON admin
{
SetPlayerHealth(playerid, INFINITY); //Setting health to defined amount
SetPlayerArmour(playerid, INFINITY); //Setting armour to defined amount
}
else //If he is NOT RCON admin
{
SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!"); //Sends a message to the player
}
return 1; //Tells the compiler that it compiled successfully
}
This is not a good way to do it.
Better do it like: pawn Код:
|
This does not matter at all if you are using it only there, also the actual value doesn't matter, it just must be high...
no need to define a makro for this... |
Originally Posted by SA:MP
1. This forum requires that you wait 120 seconds between posts. Please try again in 70 seconds.
|
This is not a good way to do it.
Better do it like: pawn Код:
|
This does not matter at all if you are using it only there, also the actual value doesn't matter, it just must be high...
no need to define a makro for this... |
Whats the difference between yours and mines? You simply replaced my values in which what you've defined. They both work. Your method though is an example of loading a callback, within a callback. Which is totally useless.
And Samety, if your having trouble with the system PM me your Teamviewer information, I'd be more than willing to help. Right on Double-O! |
Ehh Kush, the only thing I want is that the server know that I am an admin when I join the server!
|
CMD:makemeadmin(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
PlayerInfo[playerid][pAdmin] = 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
}
return 1;
}
//At top
#include <zcmd> //Credits to Zeex
new HasGod[MAX_PLAYERS];
public OnPlayerConnect(playerid) //This is a callback
{
HasGod[playerid] = 0;
return 1;
}
//Otside ANY callback
CMD:god(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
if(HasGod[playerid] == 0)
{
HasGod[playerid] = 1;
SendClientMessage(playerid, -1, "God mode turned on!");
}
else if(HasGod[playerid] == 1)
{
HasGod[playerid] = 0;
SendClientMessage(playerid, -1, "God mode turned off!");
}
}
else return SendClientMessage(playerid, -1, "You are not an admin");
return 1;
}
public OnPlayerUpdate(playerid) //this is a callback
{
if(HasGod[playerid] == 1)
{
SetTimer("SetHealth", 100, true);
}
return 1;
}
forward SetHealth(playerid);
public SetHealth(playerid) //this is a callback
{
SetPlayerHealth(playerid, 100);
return 1;
}
So from where should the server know, that when I type /makemeadmin that it's me?
It could be every player who types this! @Markx What's wrong with Kush's god command? |
Apparently his is more 'baws' as it contains a timer and uses the OnPlayerUpdate callback which checks around 32 times a second.
ON-TOPIC: /makemeadmin was a mere example. It would simply set your 'Admin' value to 1. Once at 1, you would then be allowed to use God, Teleport and Kick. |
Apparently his is more 'baws' as it contains a timer and uses the OnPlayerUpdate callback which checks around 32 times a second.
ON-TOPIC: /makemeadmin was a mere example. It would simply set your 'Admin' value to 1. Once at 1, you would then be allowed to use God, Teleport and Kick. |
Your god command wont hold all the time, after some time, you will die. e.g. get shoot by a minigun would kill you after like 30 seconds or more. Mine cant kill you and its infinity. The timer is to prevent possible lag, you can set it to 1 second so theres even lower chance to get lag.
|