admin command only - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: admin command only (
/showthread.php?tid=77575)
admin command only -
luckie12 - 12.05.2009
hi i need help how to make a admin command only?
please help me ty alot...
Re: admin command only -
Weirdosport - 12.05.2009
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;
}
Re: admin command only -
luckie12 - 12.05.2009
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:
39:
pawn Код:
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
42:
44:
please help me ty alot
Re: admin command only -
Weirdosport - 12.05.2009
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...