Next gm
#1

Hello !
I need a little help, I am working on multiple gamemodes, and I am trying to make command where admin can choose gamemode whitch will be runned next after running one finish.
Here is my command

Код:
dcmd_next(playerid, params[])
{
	if(IsPlayerAdmin(playerid))
	{
	  new string[256]; new adminname[MAX_PLAYER_NAME];
	  GetPlayerName(playerid, adminname, sizeof(adminname));
	  if(params[7] == 1)
	  {
	  	format(string, sizeof(string), "Server: %s (id: %d) has set next mission to Police Village.", adminname, playerid);
	  	SendClientMessageToAll(0xFFA500FF, string);
	  	nextmission = 1;
		}
	}
	else
	{
	  SendClientMessage(playerid, 0xFFA500FF, "Error: You are not allowed to use this command!");
	  return 1;
	}
	return 1;
}
After this mode is finished, it will changed to forced one

Код:
public OnGameModeExit()
{
	if(nextmission == 1)
	{
	  SendRconCommand("changemode PoliceVillage");
	}
	return 1;
}
my problem is, after admin type /next 1, it returns "SERVER: Unknown command." and after following game is finished it won't change to forced one.
Anyone can help to make command working?
Big Thanks.
Reply
#2

Quote:
Originally Posted by Ironboy500
Hello !
I need a little help, I am working on multiple gamemodes, and I am trying to make command where admin can choose gamemode whitch will be runned next after running one finish.
Here is my command

Код:
dcmd_next(playerid, params[])
{
	if(IsPlayerAdmin(playerid))
	{
	  new string[256]; new adminname[MAX_PLAYER_NAME];
	  GetPlayerName(playerid, adminname, sizeof(adminname));
	  if(params[7] == 1)
	  {
	  	format(string, sizeof(string), "Server: %s (id: %d) has set next mission to Police Village.", adminname, playerid);
	  	SendClientMessageToAll(0xFFA500FF, string);
	  	nextmission = 1;
		}
	}
	else
	{
	  SendClientMessage(playerid, 0xFFA500FF, "Error: You are not allowed to use this command!");
	  return 1;
	}
	return 1;
}
After this mode is finished, it will changed to forced one

Код:
public OnGameModeExit()
{
	if(nextmission == 1)
	{
	  SendRconCommand("changemode PoliceVillage");
	}
	return 1;
}
my problem is, after admin type /next 1, it returns "SERVER: Unknown command." and after following game is finished it won't change to forced one.
Anyone can help to make command working?
Big Thanks.
Use sscanf
Reply
#3

can you post mine code using sscanf?
Reply
#4

not hard really

pawn Код:
dcmd_next(playerid, params[])
{
new gm;
new string[256]; new adminname[MAX_PLAYER_NAME];
GetPlayerName(playerid, adminname, sizeof(adminname));
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "Not admin so cant use this command bla bla bla");
if(sscanf(params, "d", gm)) return SendClientMessage(playerid, COLOR_RED, "Usage bla bla bla");

format(string, sizeof(string), "Server: %s (id: %d) has set next mission to Police Village.", adminname, playerid);
SendClientMessageToAll(0xFFA500FF, string);
nextmission = 1;
return 1;
}
SHOULD Work, Untested,
ALSO You need to have the DCMD thing in OnPlayerCommandText,
I forgot about that earlier,
Reply
#5

Thanks man alot, this working. It will help to me alot and my server. Feel free to join it sometimes if you want. Just look signature
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)