SA-MP Forums Archive
Little Help with Time Command. - 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)
+--- Thread: Little Help with Time Command. (/showthread.php?tid=544305)



Little Help with Time Command. - Adarsh007 - 01.11.2014

Hello Everyone ! I want to Change my Admin Command Like /setplayertime playerid time to
/setalltime time.

That means I want to Change the Time of All. My Gamemode have a Command of Changing Player Time Can Someone Convert it to World Time Please.
As This Written in dcmd I want in dcmd. Don't Put zcmd command please....
Heres my command of Changing time of a player-
Код:
dcmd_setptime(playerid,params[])
{
	#pragma unused params
    new ID;
    new Level;
    new string[128];
    if(sscanf(params,"ui",ID,Level))
    {
        SendClientMessage(playerid, COLOR_ERROR,"{CACA00}[INFO]{FFFFFF}: /setptime [PlayerID] [Time]");
        return 1;
    }
    if(!IsPlayerConnected(ID))
    {
	 	format(string,sizeof(string),"The player ID (%d) is not connected to the server.",ID);
	 	SendClientMessage(playerid,COLOR_RED,string);
	 	return 1;
	}
	format(string, sizeof(string), "You have set %s's Playing Time to %d",PlayerName(ID),Level);
	SendClientMessage(playerid,COLOR_ADMIN,string);
	format(string,sizeof(string),"Admin %s has set your Playing Time to %d", PlayerName(playerid), Level);
	SendClientMessage(ID,COLOR_ADMIN,string);
	PlayerPlayingTimeHour[ID] =Level;
	return 1;
}
Convert the COde so i can set the world time not playertime Example - /setworldtime time
I Know there is no IsPlayerAdmin Etc, Don't Put this I Already have.


Re: Little Help with Time Command. - HY - 01.11.2014

pawn Код:
dcmd_setworldtime(playerid, params[])
{
    #pragma unused params
    new Level;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            PlayerPlayingTimeHour[i] = Level;
        }
        new string[128];
        format(string, 128, "|- Administrator %s has setted %s hours to all players -|"); // Put here your name variables, etc
        return SendClientMessageToAll(-1, string);
    }
    return 1;
}



Re: Little Help with Time Command. - Adarsh007 - 02.11.2014

1 Warning -
C:\Users\User\Desktop\gamemodes\ls.pwn(13519) : warning 203: symbol is never used: "playerid"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.


Re: Little Help with Time Command. - Quickie - 03.11.2014

pawn Код:
dcmd_setalltime(playerid,params[])
{
    #pragma unused params
    new Level;
    new string[128];
    if(sscanf(params,"i",Level))
    {
        SendClientMessage(playerid, COLOR_ERROR,"{CACA00}[INFO]{FFFFFF}: /setalltime [Time]");
        return 1;
    }
    for(new i;i!=MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            format(string,sizeof(string),"Admin %s has set your Playing Time to %d", PlayerName(playerid), Level);
            SendClientMessage(ID,COLOR_ADMIN,string);
            PlayerPlayingTimeHour[ID] =Level;
        }
    }
    format(string, sizeof(string), "You have set all connected players Playing Time to %d",Level);
    SendClientMessage(playerid,COLOR_ADMIN,string);
    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(setalltime, 10, cmdtext);
    return 0;
}