[Question]How to make a command admin only?
#1

hey i was just wondering, since i made an admin villiage, how to make the teleport an admin only command?
heres what i got... for starters..
oh i dno how to do one of those box thingos coz im kinda noob at general stuff.. lol :P

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/adminship", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid, 3203.9760,-1472.5383,16.6099);
SendClientMessage(playerid, COLOR_GREEN, "Welcome to Admin Ship!");
return 1;
}
return 0;





Reply
#2

Top Of Script

new Admin[MAX_PLAYERS];

Command

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/adminship", cmdtext, true, 10) == 0)
{
if(Admin[playerid] == 1)
}
SetPlayerPos(playerid, 3203.9760,-1472.5383,16.6099);
SendClientMessage(playerid, COLOR_GREEN, "Welcome to Admin Ship!");
return 1;
}
return 0;

tell me what you get, also

Make Yourself admin

if (strcmp("/makemeadmin",cmdtext, true, 10) == 0)
{
Admin[playerid] = 1;
return 1;
}
Reply
#3

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/adminship", cmdtext, true, 10) == 0)
{
IsPlayerAdmin(playerid) ;
{
SetPlayerPos(playerid, 3203.9760,-1472.5383,16.6099);
SendClientMessage(playerid, COLOR_GREEN, "Welcome to Admin Ship!");
return 1;
}
return 0;


That should do it.
Reply
#4

Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/adminship", cmdtext, true, 10) == 0)
{
IsPlayerAdmin(playerid) ;
{
SetPlayerPos(playerid, 3203.9760,-1472.5383,16.6099);
SendClientMessage(playerid, COLOR_GREEN, "Welcome to Admin Ship!");
return 1;
}
return 0;

thats wrong

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if (strcmp("/adminsship", cmdtext, true, 10) == 0)
{
 if(IsPlayerAdmin(playerid))
{
    SetPlayerPos(playerid, 3203.9760,-1472.5383,16.6099);
    SendClientMessage(playerid, COLOR_GREEN, "Welcome to Admins Ship!");
}
   return 1;
  }
  return 0;
that should work
Reply
#5

_saif_, your way does work but when i type /adminship as NOT an admin it doesnt take me there but it still says 'welcome to adminship'
Reply
#6

try that :

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if (strcmp("/adminship", cmdtext, true, 10) == 0)
{
 if(IsPlayerAdmin(playerid)
{
    SetPlayerPos(playerid, 3203.9760,-1472.5383,16.6099);
    SendClientMessage(playerid, COLOR_GREEN, "Welcome to Admin Ship!");
   return 1;
  }
  else { SendClientMessage(playerid, COLOR_GREEN, "Welcome to Admin Ship!"); }
  return 1;
  }
  return 0;
}
Reply
#7

Quote:
Originally Posted by [AC
Etch ]
try that :

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if (strcmp("/adminship", cmdtext, true, 10) == 0)
{
 if(IsPlayerAdmin(playerid) ;
{
    SetPlayerPos(playerid, 3203.9760,-1472.5383,16.6099);
    SendClientMessage(playerid, COLOR_GREEN, "Welcome to Admin Ship!");
   return 1;
  }
  else { SendClientMessage(playerid, COLOR_GREEN, "Welcome to Admin Ship!"); }
  return 1;
  }
  return 0;
}
you have missed this .

if(!IsPlayerAdmin(playerid)) return 0;

Bryce now it will show Unknown command to non admins
Reply
#8

edited
Reply
#9

k its all good now.. thanks heaps guys!
Reply
#10

Np
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)