17.02.2012, 10:26
Humm... The most similar thing you can do is create an enum like:
And now, you can create command like:
pawn Код:
enum sInfo
{
enum1
enum2
enum3
enum4
enum5
}
new ServerInfo[sInfo];
pawn Код:
CMD:setenum1(playerid, params[])
{
new value;
if(!sscanf(params, "d", value))
{
if(value == 1 && 5)
{
ServerInfo[enum1] = value;
}
else return SendClientMessage(playerid, 0xFFFFFFFF, "Avaliable Values: 1, 2, 3, 4, 5.");
}
else return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /setenum1 [Value(1-5)]");
}
CMD:setenum2(playerid, params[])
{
new value;
if(!sscanf(params, "d", value))
{
if(value == 1 && 5)
{
ServerInfo[enum2] = value;
}
else return SendClientMessage(playerid, 0xFFFFFFFF, "Avaliable Values: 1, 2, 3, 4, 5.");
}
else return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /setenum2 [Value(1-5)]");
}
CMD:setenum3(playerid, params[])
{
new value;
if(!sscanf(params, "d", value))
{
if(value == 1 && 5)
{
ServerInfo[enum3] = value;
}
else return SendClientMessage(playerid, 0xFFFFFFFF, "Avaliable Values: 1, 2, 3, 4, 5.");
}
else return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /setenum3 [Value(1-5)]");
}
CMD:setenum4(playerid, params[])
{
new value;
if(!sscanf(params, "d", value))
{
if(value == 1 && 5)
{
ServerInfo[enum4] = value;
}
else return SendClientMessage(playerid, 0xFFFFFFFF, "Avaliable Values: 1, 2, 3, 4, 5.");
}
else return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /setenum4 [Value(1-5)]");
}
CMD:setenum5(playerid, params[])
{
new value;
if(!sscanf(params, "d", value))
{
if(value == 1 && 5)
{
ServerInfo[enum5] = value;
}
else return SendClientMessage(playerid, 0xFFFFFFFF, "Avaliable Values: 1, 2, 3, 4, 5.");
}
else return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /setenum5 [Value(1-5)]");
}