#1

Hello, Iam already trying to script my first Script i wanna know how to make admin Command with normal Plugins like

Код:
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
Reply
#2

Use IsPlayerAdmin,

Example:

pawn Код:
if(strcmp("/kickme", cmdtext, true, 7) == 0){
    if(IsPlayerAdmin(playerid)){
        Kick(playerid);
    }
    else return SendClientMessage(playerid, -1, "You're not an admin.");
}
I suggest changing to ZCMD though and doing such as this:

pawn Код:
#include <zcmd>

CMD:kickme(playerid, params[]){
    if(IsPlayerAdmin(playerid)){
        Kick(playerid);
    }
    else return SendClientMessage(playerid, -1, "You're not an admin!");
}

EDIT:

pawn Код:
#include <a_samp>
#include <zcmd> //Include the ZCMD command processor

enum _playerData //Create the enumerator for player data
{
    pAdmin //Create the variable for administrators
}

new PlayerInfo[MAX_PLAYERS][_playerData]; //Create the variable to use the _playerData enumerator

public OnPlayerConnect(playerid){
    PlayerInfo[playerid][pAdmin] = 1; // Set this to 0 usually to reset the variable; though I set it to 1 to make them a level 1 admin.
    return 1;
}

CMD:kickme(playerid, params[]){ //Create the command to kick the player using the command
    if(PlayerInfo[playerid][pAdmin] >= 1){ //Check the administrator level of the player (to see if level 1 or above)
        Kick(playerid); //Kick the player from the server after checking their admin level is correct.
    }
    else return SendClientMessage(playerid, -1, "You're not an admin.");
    return 1;
}
Reply
#3

Very thanks i will try.
Reply
#4

i think you just didn't understand me i was talking about how to make /makeadmin command anyway thanks about this help i was looking for kick command too hehehe
Reply
#5

Quote:
Originally Posted by DionCole
Посмотреть сообщение
i think you just didn't understand me i was talking about how to make /makeadmin command anyway thanks about this help i was looking for kick command too hehehe
This is a tutorial on how to make a /setadmin command but you have to use ZCMD include to make this work
https://sampforum.blast.hk/showthread.php?tid=298218
Reply
#6

Quote:
Originally Posted by MeCom
Посмотреть сообщение
This is a tutorial on how to make a /setadmin command but you have to use ZCMD include to make this work
https://sampforum.blast.hk/showthread.php?tid=298218
Thanks alot.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)