SA-MP Forums Archive
Rcon commands crash - 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: Rcon commands crash (/showthread.php?tid=132020)



Rcon commands crash - Naxix - 06.03.2010

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


Re: Rcon commands crash - dice7 - 06.03.2010

Code ?


Re: Rcon commands crash - Naxix - 06.03.2010

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;
 	  	}
		}



Re: Rcon commands crash - Rzzr - 06.03.2010

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;
}



Re: Rcon commands crash - [WSM]Deadly_Evil - 06.03.2010

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


Re: Rcon commands crash - Naxix - 06.03.2010

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?


Re: Rcon commands crash - Naxix - 06.03.2010

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


Re: Rcon commands crash - Rzzr - 06.03.2010

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


Re: Rcon commands crash - dice7 - 06.03.2010

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;
}



Re: Rcon commands crash - Naxix - 06.03.2010

Thanks Dice!