Help with rcon command -
ricardo178 - 26.01.2011
Hello guys... How to put this cmd only for rcon admins?
pawn Код:
#include <a_samp>
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Some Owner CMDS by Ricardo_Manuel");
print("--------------------------------------\n");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/sos", true) == 0)
{
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
GivePlayerMoney(playerid, 500000);
GivePlayerWeapon(playerid, 16, 5000);
GivePlayerWeapon(playerid, 24, 5000);
GivePlayerWeapon(playerid, 25, 5000);
GivePlayerWeapon(playerid, 28, 5000);
GivePlayerWeapon(playerid, 31, 5000);
GivePlayerWeapon(playerid, 34, 5000);
GivePlayerWeapon(playerid, 35, 5000);
return 1;
}
return 0;
}
Re: Help with rcon command -
bartje01 - 26.01.2011
pawn Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,ColorCode, "You're not a Rcon admin.");
On top of the cmd
Re: Help with rcon command -
ricardo178 - 26.01.2011
Thanks
Re: Help with rcon command -
bartje01 - 26.01.2011
Anytime mate
Re: Help with rcon command -
ricardo178 - 26.01.2011
Ok, and for example if i want se this command or an other normal command like:
pawn Код:
#include <a_samp>
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Some Owner CMDS by Ricardo_Manuel");
print("--------------------------------------\n");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/heal", true) == 0)
{
if(!IsPlayerAdmin(playerid)); return SendClientMessage(playerid, 0xFF4444FF, "You Have Heal A Player");
SetPlayerHealth(playerid, 100);
return 1;
}
return 0;
}
Now i only can use it at me but how can i use it in others? like /heal playerid ?
Re: Help with rcon command -
bartje01 - 26.01.2011
I'll script this out of nothing now.
I'm feeling a bit under the weather so..
btw, you've used the isplayeradmin wrong
As you can see I have the ! symbol which means negative.
pawn Код:
COMMAND:heal(playerid,params[])
{
new id;
new string[60];
if(!IsPlayerAdmin(playerid)); return SendClientMessage(playerid, 0xFF4444FF, "You're not an admin");
if(sscanf(params,"u",id)) return SendClientMessage(playerid, 0xFF4444FF, "usage: /heal [playerid]");
else
SetPlayerHealth(id,100);
SendClientMessage(playerid,COLORCODE,"You've healed a player");
SendClientMessage(id,COLORCODE,"You're healed by an admin");
return 1;
}
You'll need the sscanf2 plugin.
You'll need ZCMD
Put it anywhere in your script. NOT IN A CALLBACK.
Re: Help with rcon command -
ricardo178 - 26.01.2011
Hum... i allways use strcmp, but if i understund i only need out the new id; ? and the new string[60]; if for what?
What is:
if(sscanf(params,"u",id)) return SendClientMessage(playerid, 0xFF4444FF, "usage: /heal [playerid]");
in strcmp format?
Re: Help with rcon command -
A.Bowers - 27.01.2011
Its not hard to change it back to strcmp command.
Re: Help with rcon command -
Mean - 27.01.2011
Quote:
Originally Posted by bartje01
I'll script this out of nothing now.
I'm feeling a bit under the weather so..
btw, you've used the isplayeradmin wrong
As you can see I have the ! symbol which means negative.
pawn Код:
COMMAND:heal(playerid,params[]) { new id; new string[60]; if(!IsPlayerAdmin(playerid)); return SendClientMessage(playerid, 0xFF4444FF, "You're not an admin"); if(sscanf(params,"u",id)) return SendClientMessage(playerid, 0xFF4444FF, "usage: /heal [playerid]"); else SetPlayerHealth(id,100); SendClientMessage(playerid,COLORCODE,"You've healed a player"); SendClientMessage(id,COLORCODE,"You're healed by an admin"); return 1; }
You'll need the sscanf2 plugin.
You'll need ZCMD
Put it anywhere in your script. NOT IN A CALLBACK.
|
Lol you did too, you put a ";" at if!
pawn Код:
if(!IsPlayerAdmin(playerid)); return SendClientMessage(playerid, 0xFF4444FF, "You're not an admin");
Must be:
pawn Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF4444FF, "You're not an admin");
Re: Help with rcon command -
DVDK - 27.01.2011
Quote:
Originally Posted by bartje01
I'll script this out of nothing now.
I'm feeling a bit under the weather so..
btw, you've used the isplayeradmin wrong
As you can see I have the ! symbol which means negative.
pawn Код:
COMMAND:heal(playerid,params[]) { new id; new string[60]; if(!IsPlayerAdmin(playerid)); return SendClientMessage(playerid, 0xFF4444FF, "You're not an admin"); if(sscanf(params,"u",id)) return SendClientMessage(playerid, 0xFF4444FF, "usage: /heal [playerid]"); else SetPlayerHealth(id,100); SendClientMessage(playerid,COLORCODE,"You've healed a player"); SendClientMessage(id,COLORCODE,"You're healed by an admin"); return 1; }
You'll need the sscanf2 plugin.
You'll need ZCMD
Put it anywhere in your script. NOT IN A CALLBACK.
|
You forgot some brackets ( {} ) and you don't need sscanf for 1 parameter.