admin command only
#1

hi i need help how to make a admin command only?

please help me ty alot...
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
        {
        if(IsPlayerAdmin(playerid))
            {
            //command
            }
        else
            {
            SendClientMessage(playerid, 0xFF00FFFF, "You're not an admin, sorry");
            }
        }

    return 0;
}
Reply
#3

Quote:
Originally Posted by Weirdosport
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
        {
        if(IsPlayerAdmin(playerid))
            {
            //command
            }
        else
            {
            SendClientMessage(playerid, 0xFF00FFFF, "You're not an admin, sorry");
            }
        }

    return 0;
}
i get errors
its only at this:

pawn Код:
}
        }

    return 0;
}
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}
#endif
and this are the errors:

pawn Код:
C:\Documents and Settings\Luc\Bureaublad\Pawno\filterscripts\AdminCommand.pwn(37) : warning 217: loose indentation
C:\Documents and Settings\Luc\Bureaublad\Pawno\filterscripts\AdminCommand.pwn(39) : error 010: invalid function or declaration
C:\Documents and Settings\Luc\Bureaublad\Pawno\filterscripts\AdminCommand.pwn(42) : error 010: invalid function or declaration
C:\Documents and Settings\Luc\Bureaublad\Pawno\filterscripts\AdminCommand.pwn(44) : error 010: invalid function or declaration
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.
and this is line 37 39 24 and 44:

37:
pawn Код:
return 0;
39:
pawn Код:
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
42:
pawn Код:
return 1;
44:
pawn Код:
return 0;
please help me ty alot
Reply
#4

Not sure what the hell is going on there, you shouldn't have #endif after OnPlayerCommandText, you have more than 1 return 0; which isn't right.. Send more of your OnPlayerCommandText stuff...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)