26.03.2013, 18:20
I want to convert this to ZCMD and add so admin rank 4 only can use that commands
Код:
#include <a_samp>
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_GREY 0xAFAFAFAA
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
public OnFilterScriptInit()
{
print("|----- Disaster's Time & Weather Sistem -----|");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(time, 7, cmdtext);
dcmd(weather, 10, cmdtext);
return 0;
}
dcmd_time(playerid,params[])
{
new string[128];
if(!strlen(params))
{
SendClientMessage(playerid, COLOR_WHITE, " * Usage: /time [0-24]");
return 1;
}
new hour = strval(params);
if(hour < 0 || hour > 24)
{
SendClientMessage(playerid, COLOR_GREY, " * Usage: /time [0-24]");
return 1;
}
SetPlayerTime(playerid, hour, 0);
format(string,sizeof(string), " * You changed your time to %d:00 !", hour);
SendClientMessage(playerid, COLOR_ORANGE, string);
return 1;
}
dcmd_weather(playerid,params[])
{
new string[128];
if(!strlen(params))
{
SendClientMessage(playerid, COLOR_WHITE, " * Usage: /weather [0-45]");
return 1;
}
new weather = strval(params);
if(weather < 0 || weather > 45)
{
SendClientMessage(playerid, COLOR_GREY, " * Usage: /weather [0-45]");
return 1;
}
SetPlayerWeather(playerid, weather);
format(string,sizeof(string), " * You changed your weather to ID:%d!", weather);
SendClientMessage(playerid, COLOR_ORANGE, string);
return 1;
}



LOL