Hi i need a cmd /setnight to set darkness on my test sv because it doesnt have that day/night thing its always day.I have no idea how to script this so if u can help me please do it C:-)
Something like this
CMD:settime(playerid, params[])
{
new time, string[128];
if(sscanf(params, "i", time)) return SendClientMessage(playerid, -1, "Usage: /settime [time]");
if(time > 24 || time < 0) return SendClientMessage(playerid, -1, "Error: Invalid time!");
SetWorldTime(time);
format(string, sizeof(string), "Time set to %d", time);
SendClientMessage(playerid, 0x00FF00FF, string);
return 1;
}
or
CMD:setnight(playerid, params[])
{
SetWorldTime(0); //midnight
SendClientMessage(playerid, 0x00FF00FF, "Time set to midnight.");
return 1;
}
The second one looks easier, where do i input that?i mean which part of gamemod?
Just put it somewhere. I always have all the commands at the end of the code.
....
....
....
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
CMD:setnight(playerid, params[])
{
SetWorldTime(0); //midnight
SendClientMessage(playerid, 0x00FF00FF, "Time set to midnight.");
return 1;
}
And you need to include #include <zcmd>
grandlarc.pwn(14) : fatal error 100: cannot read from file: "zcmd"
Well yea cuz you need to add http://forum.sa-mp.com/showthread.php?t=91354 zcmd in to include folder of pawn
Quote from: Dr_Alio on February 12, 2017, 12:05
Well yea cuz you need to add http://forum.sa-mp.com/showthread.php?t=91354 zcmd in to include folder of pawn
U got team viewer? Dont want to fck everything up Carl worked a lot to fix my streamer
Just download zcmd from SAMP forums and put it into /includes folder then include it in gamemode using #include <zcmd>, also you need sccanf 2 plugin file for 1st commad.
Well to avoid using ZCMD, you can do this.
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/night") == 0)
{
SetWorldTime(0); // or 12 'o clock
SendClientMessage(playerid, 0x00FF00FF, "Time set to midnight.");
return 1;
}
return 0;
}
Quote from: CarlJohnson on February 12, 2017, 16:25
Well to avoid using ZCMD, you can do this.
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/night") == 0)
{
SetWorldTime(0); // or 12 'o clock
SendClientMessage(playerid, 0x00FF00FF, "Time set to midnight.");
return 1;
}
return 0;
}
Alio is doing some things now to fix becuz he broke the server,stay in touch we'll need your help=)))
CarlJohnson I had to update all includes and plugins and than it worked :D
Quote from: Dr_Alio on February 12, 2017, 17:16
CarlJohnson I had to update all includes and plugins and than it worked :D
^^ Great job, without u or carl i would have never figured out this whole test server thing
Quote from: DOC on February 12, 2017, 17:19
without u or carl i would have never figured out this whole test server thing
and to think I cant get mine to work after two years of having it
Quote from: Ethan on February 12, 2017, 20:22
Quote from: DOC on February 12, 2017, 17:19
without u or carl i would have never figured out this whole test server thing
and to think I cant get mine to work after two years of having it
:biggrin:
SA:MP scripting is one of the easiest things to learn. Message me on Steam if you like Ethan.