Settime dcmd into normal command
#1

Hey there,

I got this command but I am trying to make it a normal command, since my script doesn't like the dcmd commands :S Could someone help me please? I would appreciate the help. And of course I would like to make it so RCON admin can use it, not AdminLevel. I think that would be if(IsPlayerAdmin (playerid)) :P, but not a 100% sure. Thanks, Below I give you the code:

Код:
dcmd_settime(playerid,params[]) {
	if(PlayerInfo[playerid][AdminLevel]>=g_Level[lsettime]) {
		new
			hour;
		if (sscanf(params, "d",hour)) {
			return SendClientFormatMessage(playerid,COLOR_SYSTEM,"%s: /settime [Hour]",GetLanguageString(GetPlayerLanguageID(playerid),"txt_icommands"));
		}
		else if(hour < 0 || hour > 23 ) {
			return SendClientLanguageMessage(playerid,COLOR_RED2,"txt_worldtime1");
		}
		else {
			g_Time=hour;
			g_TimeUpdate_Count=0;
			SetWorldTime(g_Time);
			CreateClientLanguageMessages("txt_worldtime2",g_Time);
			SendAdminCommand(COLOR_YELLOW);
			return WriteLog(clearlog,LanguageString(ServerLanguage()));
		}
	}
	else {
		SendClientLanguageMessage(playerid,COLOR_LIGHTBLUE,"txt_error404");
	}
	return 1;
}
Thanks and Regards
Puzi
Reply
#2

These should be on top of OnPlayerCommandText:
Код:
new idx;
new cmd[256];
new tmp[256];
And this is the command:
Код:
	if(strcmp(cmd, "/settime", true) == 0)
		{
		tmp=strtok(cmdtext, idx);
		if(PlayerInfo[playerid][AdminLevel]>=g_Level[lsettime])
			{
			new hour;
			if(sscanf(strval(tmp), "d",hour))
				{
				return SendClientFormatMessage(playerid,COLOR_SYSTEM,"%s: /settime [Hour]",GetLanguageString(GetPlayerLanguageID(playerid),"txt_icommands"));
				}
			else if(hour < 0 || hour > 23 )
				{
				return SendClientLanguageMessage(playerid,COLOR_RED2,"txt_worldtime1");
				}
			else
				{
				g_Time=hour;
				g_TimeUpdate_Count=0;
				SetWorldTime(g_Time);
				CreateClientLanguageMessages("txt_worldtime2",g_Time);
				SendAdminCommand(COLOR_YELLOW);
				return WriteLog(clearlog,LanguageString(ServerLanguage()));
				}
			}
		else
			{
			SendClientLanguageMessage(playerid,COLOR_LIGHTBLUE,"txt_error404");
			}
		return 1;
		}
Reply
#3

Are you sure this command is for normal admin? I mean RCON...
Reply
#4

I am not sure about nothing. I just did convert your command from dcmd to normal command, not changing anything else.

Here you gocommand for RCON admins)
Код:
	if(strcmp(cmd, "/settime", true) == 0)
		{
		tmp=strtok(cmdtext, idx);
		if(IsPlayerAdmin(playerid))
			{
			new hour;
			if(sscanf(strval(tmp), "d",hour))
				{
				return SendClientFormatMessage(playerid,COLOR_SYSTEM,"%s: /settime [Hour]",GetLanguageString(GetPlayerLanguageID(playerid),"txt_icommands"));
				}
			else if(hour < 0 || hour > 23 )
				{
				return SendClientLanguageMessage(playerid,COLOR_RED2,"txt_worldtime1");
				}
			else
				{
				g_Time=hour;
				g_TimeUpdate_Count=0;
				SetWorldTime(g_Time);
				CreateClientLanguageMessages("txt_worldtime2",g_Time);
				SendAdminCommand(COLOR_YELLOW);
				return WriteLog(clearlog,LanguageString(ServerLanguage()));
				}
			}
		else
			{
			SendClientLanguageMessage(playerid,COLOR_LIGHTBLUE,"txt_error404");
			}
		return 1;
		}
Reply
#5

Код:
C:\Users\PUZI\Desktop\RPG TDM (all versions) + SA TDM\RPG.pwn(3853) : error 017: undefined symbol "sscanf"
C:\Users\PUZI\Desktop\RPG TDM (all versions) + SA TDM\RPG.pwn(3855) : error 017: undefined symbol "SendClientFormatMessage"
C:\Users\PUZI\Desktop\RPG TDM (all versions) + SA TDM\RPG.pwn(3859) : error 017: undefined symbol "SendClientLanguageMessage"
C:\Users\PUZI\Desktop\RPG TDM (all versions) + SA TDM\RPG.pwn(3863) : error 017: undefined symbol "g_Time"
C:\Users\PUZI\Desktop\RPG TDM (all versions) + SA TDM\RPG.pwn(3863) : warning 215: expression has no effect
C:\Users\PUZI\Desktop\RPG TDM (all versions) + SA TDM\RPG.pwn(3864) : error 017: undefined symbol "g_TimeUpdate_Count"
C:\Users\PUZI\Desktop\RPG TDM (all versions) + SA TDM\RPG.pwn(3864) : warning 215: expression has no effect
C:\Users\PUZI\Desktop\RPG TDM (all versions) + SA TDM\RPG.pwn(3865) : error 017: undefined symbol "g_Time"
C:\Users\PUZI\Desktop\RPG TDM (all versions) + SA TDM\RPG.pwn(3866) : error 017: undefined symbol "CreateClientLanguageMessages"
C:\Users\PUZI\Desktop\RPG TDM (all versions) + SA TDM\RPG.pwn(3867) : error 017: undefined symbol "SendAdminCommand"
C:\Users\PUZI\Desktop\RPG TDM (all versions) + SA TDM\RPG.pwn(3868) : error 017: undefined symbol "WriteLog"
C:\Users\PUZI\Desktop\RPG TDM (all versions) + SA TDM\RPG.pwn(3873) : error 017: undefined symbol "SendClientLanguageMessage"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


10 Errors.
Reply
#6

These errors are because of your includes or something. You asked to transform that command into normal command and just for RCON admins. That's what i did. I will make a simple settime command for you:
Код:
	if(strcmp(cmd, "/settime", true) == 0)
		{
		tmp=strtok(cmdtext, idx);
		if(IsPlayerAdmin(playerid))
			{
			SetWorldTime(strval(tmp));
			return 1;
			}
		else
		    {
		    SendClientMessage(playerid, COLOR_RED, "SERVER: You are not admin.");
		    return 1;
		    }
		}
Reply
#7

Thanks, that worked. I am not so advanced in PAWNO, and, I got it out of a script. Thanks anyways
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)