setalltime cmd not working [+rep]
#1

Solved!
Reply
#2

Could you explain why it is not working? What happens?
Also, it is better to use sscanf with zcmd instead of strval.
Reply
#3

pawn Код:
CMD:setalltime(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 4) {
        if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /setalltime [hour]");
        new var = strval(params), string[128];
        if(var > 24) return SendClientMessage(playerid, red, "ERROR: Invalid hour");
        CMDMessageToAdmins(playerid,"SETALLTIME");
        for(new i = 0; i < MAX_PLAYERS; i++) {
            if(IsPlayerConnected(i)) {
                PlayerPlaySound(i,1057,0.0,0.0,0.0);
                SetPlayerTime(i, var, 0);
            }
        }
        format(string,sizeof(string),"Administrator \"%s\" has set all players time to '%d:00'", pName(playerid), var );
        return SendClientMessageToAll(blue, string);
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
Try This Maybe Help You
Reply
#4

it works perfect but actually it not change server time

For example i do

/setalltime 12 it say it change but the time not and the time and weather is be like same
Reply
#5

Try /setalltime 12:00 LoL :V
Reply
#6

Quote:
Originally Posted by LMaxCo
Посмотреть сообщение
pawn Код:
CMD:setalltime(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 4) {
        if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /setalltime [hour]");
        new var = strval(params), string[128];
        if(var > 24) return SendClientMessage(playerid, red, "ERROR: Invalid hour");
        CMDMessageToAdmins(playerid,"SETALLTIME");
        for(new i = 0; i < MAX_PLAYERS; i++) {
            if(IsPlayerConnected(i)) {
                PlayerPlaySound(i,1057,0.0,0.0,0.0);
                SetPlayerTime(i, var, 0);
            }
        }
        format(string,sizeof(string),"Administrator \"%s\" has set all players time to '%d:00'", pName(playerid), var );
        return SendClientMessageToAll(blue, string);
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
Try This Maybe Help You
not working
Reply
#7

Why I Can Use It To My Server? Maybe You Dont Know How To Use That Command, Try /setalltime 00:00
Reply
#8

i know how to use that command but this cmd is not working
Reply
#9

Код:
CMD:setalltime(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 4) {
	    if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /setalltime [hour]");
		new var = strval(params), string[128];
		if(var > 24) return SendClientMessage(playerid, red, "ERROR: Invalid hour");
       	CMDMessageToAdmins(playerid,"SETALLTIME");
		for(new i = 0; i < MAX_PLAYERS; i++) {
			if(IsPlayerConnected(i)) {
				PlayerPlaySound(i,1057,0.0,0.0,0.0);
				SetPlayerTime(i, var, 0);
			}
		}
		format(string,sizeof(string),"Administrator \"%s\" has set all players time to '%d:00'", pName(playerid), var );
		return SendClientMessageToAll(blue, string);
	} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
Try This.
Reply
#10

Quote:
Originally Posted by Rog
Посмотреть сообщение
Код:
CMD:setalltime(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 4) {
	    if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /setalltime [hour]");
		new var = strval(params), string[128];
		if(var > 24) return SendClientMessage(playerid, red, "ERROR: Invalid hour");
       	CMDMessageToAdmins(playerid,"SETALLTIME");
		for(new i = 0; i < MAX_PLAYERS; i++) {
			if(IsPlayerConnected(i)) {
				PlayerPlaySound(i,1057,0.0,0.0,0.0);
				SetPlayerTime(i, var, 0);
			}
		}
		format(string,sizeof(string),"Administrator \"%s\" has set all players time to '%d:00'", pName(playerid), var );
		return SendClientMessageToAll(blue, string);
	} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
Try This.
i try but its not working for me
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)