Convert to ZCMD
#1

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;
}
Reply
#2

I don't know which saving system you use for admin levels
But basiclly you can use if(pInfo[playerid][Admin] >3)
Or

if(pInfo[playerid][Admin] >= 4)
pawn Код:
CMD: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;
}

CMD: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;
}
Reply
#3

Quote:
Originally Posted by Scrillex
Посмотреть сообщение
I don't know which saving system you use for admin levels
But basiclly you can use if(pInfo[playerid][Admin] >3)
pawn Код:
CMD: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;
}

CMD: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;
}
Код:
if (PlayerInfo[playerid][pAdmin] >= 4)
Reply
#4

Edited! LOL They bouth would work anyway because it's checks if admin lvl is bigger then that!
Reply
#5

Quote:
Originally Posted by Scrillex
Посмотреть сообщение
Edited! LOL They bouth would work anyway because it's checks if admin lvl is bigger then that!
You didnt add that?
Reply
#6

See at the top post lol As I said edited!
Reply
#7

Quote:
Originally Posted by Scrillex
Посмотреть сообщение
See at the top post lol As I said edited!
C:\Users\Ramin\Desktop\Spel\PL-RP\filterscripts\time.pwn(21) : error 017: undefined symbol "dcmd_time"
C:\Users\Ramin\Desktop\Spel\PL-RP\filterscripts\time.pwn(22) : error 017: undefined symbol "dcmd_weather"
C:\Users\Ramin\Desktop\Spel\PL-RP\filterscripts\time.pwn(65) : warning 203: symbol is never used: "time"
C:\Users\Ramin\Desktop\Spel\PL-RP\filterscripts\time.pwn(65) : warning 203: symbol is never used: "weather"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)