SA-MP Forums Archive
Whats the problem here? - 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: Whats the problem here? (/showthread.php?tid=85589)



Whats the problem here? - tomnidi - 08.07.2009

Код:
if (strcmp(cmd, "/loadfs", true) ==0 )
	{
	  if(IsPlayerConnected(playerid))
	  {
			if (PlayerInfo[playerid][pAdmin] >= 1337)
			{
        tmp = strtok(cmdtext, idx);
			  if(!strlen(tmp))
			  {
				  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /loadfs [fs name]");
				  return 1;
			  }
			  new level;
			  level = strval(tmp);
			  format(string, sizeof(string), "loadfs %s", level);
      	SendRconCommand(string);
			}
		}
		ret
Doesn't work.. Any ideas?


Re: Whats the problem here? - refshal - 08.07.2009

pawn Код:
#include a_samp

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/loadfs", true) ==0 )
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] >= 1337)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE]: /loadfs [fs name]");
return 1;
}
new level;
level = strval(tmp);
format(string, sizeof(string), "/loadfs %s", level);
SendRconCommand(string);
return 1;
}
return 0;
}



Re: Whats the problem here? - tomnidi - 08.07.2009

I'm pretty sure you don't have to put the "/" on SendReconCommand, anyway its not working too.


Re: Whats the problem here? - refshal - 08.07.2009

Maybe just "SendRconCommand("loadfs");"?


Re: Whats the problem here? - tomnidi - 08.07.2009

loadfs... what? I need to load %s fs, not just an "fs"...
Someone can help me please?


Re: Whats the problem here? - Correlli - 08.07.2009

Quote:
Originally Posted by еddy
pawn Код:
format(string, sizeof(string), "/loadfs %s", level);
SendRconCommand(string);
}
What you did is wrong, it should be like:
pawn Код:
format(string, sizeof(string), "loadfs %s", level);
SendRconCommand(string);



Re: Whats the problem here? - tomnidi - 08.07.2009

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by еddy
pawn Код:
format(string, sizeof(string), "/loadfs %s", level);
SendRconCommand(string);
}
What you did is wrong, it should be like:
pawn Код:
format(string, sizeof(string), "loadfs %s", level);
SendRconCommand(string);
Hmm I didn't do that, he told me to try that, but this is not working, both of the options..


Re: Whats the problem here? - Correlli - 08.07.2009

Quote:
Originally Posted by tomnidi
Hmm I didn't do that, he told me to try that, but this is not working, both of the options..
I wasn't refering to you. Add debug messages to see where the problem appears.


Re: Whats the problem here? - Nero_3D - 08.07.2009

Thats code is an opposite in itself
pawn Код:
new level;
              level = strval(tmp); //gets the interger of the array tmp
              format(string, sizeof(string), "loadfs %s", level); //to try insert an integer as a string
pawn Код:
if (strcmp(cmd, "/loadfs", true) ==0 )
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdmin] >= 1337)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                    return SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /loadfs [fs name]");
                format(string, sizeof(string), "loadfs %s", tmp);
                SendRconCommand(string);
            }
        }
        return true;
    }



Re: Whats the problem here? - tomnidi - 08.07.2009

Works great, thank you