How to create an Admin Comand!? - 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: How to create an Admin Comand!? (
/showthread.php?tid=71693)
How to create an Admin Comand!? -
Fragoso - 03.04.2009
Hi All
I Was Woundering If Someone can help me here with admins comands.
I Want To Do Something Like This:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp"(/disarm", cmdtext, true) ==0)
{
ResetPlayerWeapon(playerid);
return 1;
USAGE: /disarm [ID]
I Want It On Level 1337 Admin.
Can SomeOne Explaine me How To?
Re: How to create an Admin Comand!? -
[RP]Rav - 03.04.2009
you need something like this
pawn Код:
if ( [admin level] < 1337)
return 0;
Re: How to create an Admin Comand!? -
Rks25 - 03.04.2009
And you need to define giveplayerid and use strtok.
Re: How to create an Admin Comand!? -
MenaceX^ - 03.04.2009
Quote:
Originally Posted by Rk_
And you need to define giveplayerid and use strtok.
|
And what is giveplayerid?..
pawn Код:
strtok(const string[], &index, separator = ' ')
{
new length = strlen(string);
while ((index < length) && (string[index] <= separator))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > separator) && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
pawn Код:
new
cmd[128],
id;
if(!strcmp(cmd,"/disarm",true))
{
if ([admin level]<1337)
return 0;
cmd=strtok(cmdtext,idx);
if(!strlen(cmd))
return SendClientMessage(playerid,color,"USAGE: /disarm [ID]");
id=ReturnUser(cmd);
if(!IsPlayerConnected(id))
return 0;
ResetPlayerWeapons(id);
return 1;
}
It's edited because I wrongly posted before finishing the code.