Help with rcon command
#1

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;
}
Reply
#2

pawn Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,ColorCode, "You're not a Rcon admin.");
On top of the cmd
Reply
#3

Thanks
Reply
#4

Anytime mate
Reply
#5

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 ?
Reply
#6

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.
Reply
#7

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?
Reply
#8

Its not hard to change it back to strcmp command.
Reply
#9

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");
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)