SA-MP Forums Archive
help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: help (/showthread.php?tid=593753)



help - DionCole - 09.11.2015

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



Re: help - iGetty - 09.11.2015

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;
}



Re: help - DionCole - 09.11.2015

Very thanks i will try.


Re: help - DionCole - 09.11.2015

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


Re: help - MeCom - 09.11.2015

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


Re: help - DionCole - 10.11.2015

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.