26.07.2010, 03:34
(
Последний раз редактировалось Kitten; 24.11.2013 в 04:50.
)
Solved
//AT TOP OF ONPLAYERCOMMANDTEXT
new tmp[256],cmd[256],idx;
cmd = strtok(cmdtext,idx);
tmp = strtok(cmdtext,idx);
if(!strcmp(cmd,"/Setgm",true))
{
if(IsPlayerAdmin(playerid))
{
if(!strlen(tmp)||strval(tmp)<0||strval(tmp)>3) return SendClientMessage(playerid,COLOR_MESSAGES,"USEAGE: /Setgm [1 - 3]");
switch(strval(tmp))
{
case 1:
{
SendRconCommand("changemode Race 1");
SendRconCommand("changemode");
}
case 2:
{
SendRconCommand("changemode Race 2");
SendRconCommand("changemode");
}
case 3:
{
SendRconCommand("changemode Race 3");
SendRconCommand("changemode");
}
}
}
else
{
SendClientMessage(playerid, COLOR, "You are NOT an admin");
}
return 1;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}