Rcon commands crash
#1

Hey there!

I was makeing a couple rcon commands to my GM, but sometimes they work other time they just crash the server.
And most of the time, that they work they don't even use the "SendClientMessage" i used.
Does any1 know why they do this?

-Naxix
Reply
#2

Code ?
Reply
#3

This is one of my cmds.

Код:
 	if (strcmp("/armour (playerid)", cmdtext, true, 7) == 0) // Change "/armour" to whatever you want to e.g "/a" (a for armour)
 	{
 		if(IsPlayerAdmin(playerid)) // This checks if the player is logged on Rcon.
 		{
 		  SetPlayerArmour(playerid, 100); // This sets the armour of the player to 100.
			SendClientMessage(playerid,COLOUR_RED,"You gave armour to %s!"); // This sends the msg "You gave armour to [name of the player]" change it to what you want it to say. This will only be seen by you
      SendPlayerMessageToPlayer(playerid, COLOUR_YELLOW,"%s gave you armour!"); // This will send a msg to the player and inform him/her that you gave him/her armour. You can change the text. (only Him/her will see it)
      return 1;
 	  	}
		}
Reply
#4

pawn Код:
if (strcmp("/armour (playerid)", cmdtext, true, 7) == 0)
{
if(IsPlayerAdmin(playerid))
{
SetPlayerArmour(playerid, 100);
SendClientMessage(playerid,COLOUR_RED,"You gave armour to %s!");
SendPlayerMessageToPlayer(playerid, COLOUR_YELLOW,"%s gave you armour!"); // I dont know what this does, but I think it won't show a name because you didn't get a name, you just put %s
}
return 1;
}
Reply
#5

Naxix why you put %s when there is no format at all
and what is this command?? /armour (playerid) LOL
Reply
#6

Quote:
Originally Posted by [GTA
Deadly_Evil ]
Naxix why you put %s when there is no format at all
and what is this command?? /armour (playerid) LOL
I knew about the first one..
And why do you care what i make commands for?

But at the first one.. Do you think that cut make my server crash?
Reply
#7

Quote:
Originally Posted by LowCo.
pawn Код:
if (strcmp("/armour (playerid)", cmdtext, true, 7) == 0)
{
if(IsPlayerAdmin(playerid))
{
SetPlayerArmour(playerid, 100);
SendClientMessage(playerid,COLOUR_RED,"You gave armour to %s!");
SendPlayerMessageToPlayer(playerid, COLOUR_YELLOW,"%s gave you armour!"); // I dont know what this does, but I think it won't show a name because you didn't get a name, you just put %s
return 1;
}
And that wont work.. You need 2 ending brackets
Reply
#8

Omfg I forgot it, even though I that was what I wanted to correct :P
thanks for the correction, edited my post!
Reply
#9

your code still wont work

pawn Код:
if (strcmp("/armour [id]", cmdtext, true, 8) == 0) // to compare the first 8 characters
{
    if(IsPlayerAdmin(playerid)) //if the player who typed the cmd is an rcon admin
    {
        new id = strval(cmdtext[8]); //the 'id' which the player typed starts at the 8th index in "cmdtext"
       
        if(IsPlayerConnected(id)) //to check if the player is even connected
        {
            SetPlayerArmour(id, 100); //give armour
           
            new name[MAX_PLAYER_NAME];
            GetPlayerName(id, name, MAX_PLAYER_NAME); //getting the name of the player which got the armour
            new str[128]; //the string which will be sent
            format(str, 128, "You gave armour to %s !", name); //formating it
            SendClientMessage(playerid, COLOUR_RED, str); //sending it
           
            GetPlayerName(playerid, name, MAX_PLAYER_NAME); //reusing the array 'name' to store the players name who typed the cmd
            format(str, 128, "%s gave you armour !", name); //formating the msg
            SendClientMessage(playerid, COLOUR_RED, str); //sending it
            return 1; //ending the code so the code below doesn't get executed
        }
        SendClientMessage(playerid, COLOUR_RED, "No player found"); //player isn't connected
        return 1;
    }
    SendClientMessage(playerid, COLOUR_RED, "You need to be an rcon admin to use this cmd");
    return 1;
}
Reply
#10

Thanks Dice!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)