Simple things
#1

Why it doesnt show UNKNOWN COMMAND if i do random commands like /dasfgvsdvasvds
How to make a command available only after 5 mins?
How to make frames like this?
Reply
#2

To the first thing: you have a "return 1;" in your OnPlayerCommandText (at last). Replace it with return 0;

The second one i dont understand...
Reply
#3

And what about frames/ command available ?
Reply
#4

anyone?
Reply
#5

To make a command only usable after a set amount of time you need to capture the current tick time and add to it 5 minutes and compare once the player types in the command again.

Example:
pawn Code:
#define DELAY_TIME 5000 //5 seconds in millseconds

#define DELAY_COMMANDS 2 //2 different commands are delayed

#define DELAY_ADVERT 0 //first command is 0

#define DELAY_HEAL 1 //second command is 1 and so on...

new pDelayCommands[MAX_PLAYERS][DELAY_COMMANDS];

public OnPlayerCommandText(playerid,cmdtext)
{
  if(!strcmp(cmdtext[1],"advert",true,6))
  {
    if(pDelayCommands[playerid][DELAY_ADVERT]>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"You cannot do that yet!");
    pDelayCommands[playerid][DELAY_ADVERT]=GetTickCount()+DELAY_TIME;
    new string[200];
    format(string,sizeof(string),"Advertisement: %s",cmdtext[8]);
    SendClientMessageToAll(0xAAAA00FF,string);
    return 1;
  }
  if(!strcmp(cmdtext[1],"heal",true,6))
  {
    if(pDelayCommands[playerid][DELAY_HEAL]>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"You cannot do that yet!");
    pDelayCommands[playerid][DELAY_HEAL]=GetTickCount()+DELAY_TIME;
    SetPlayerHealth(playerid,100.0);
    new string[128];
    GetPlayerName(playerid,string,sizeof(string));
    format(string,sizeof(string),"%s healed himself.",string);
    SendClientMessageToAll(0xAAAA00FF,string);
    return 1;
  }
  return 0;
}
Reply
#6

Quote:
Originally Posted by DeathOnaStick
To the first thing: you have a "return 1;" in your OnPlayerCommandText (at last). Replace it with return 0;

The second one i dont understand...
This is the last command in my onplayercommandtext, and also my last lines on it.
Code:
dcmd_buildmenu(playerid,params[])
{
	#pragma unused params
	if(PlayerInfo[playerid][pAdmin] >= 1)
 	{
		if(RaceBuilders[playerid] == 0)
		{
			SendClientMessage(playerid, COLOR_GREY, "[Error] You are not building a race");
			return 1;
		}
		if(BAirrace[b(playerid)] == 0) SetMenuColumnHeader(MBuild,0,"Air race: Off");
		else SetMenuColumnHeader(MBuild,0,"Air race: On");
		if(!IsValidMenu(MBuild)) CreateRaceMenus();
		TogglePlayerControllable(playerid,0);
		ShowMenuForPlayer(MBuild,playerid);
		return 1;
	}
	else
	{
	SendClientMessage(playerid, COLOR_WHITE, "[Error] Unknown Command.");
	}
	return 0;
}
But it doesn't work, i still don't get any Error thing..
Only when i type "/"
Could anybody help me
Reply
#7

That's your command function. Look under OnPlayerCommandText, turn the return 1; at the END of it into return 0;
Reply
#8

Quote:
Originally Posted by Joe Staff
That's your command function. Look under OnPlayerCommandText, turn the return 1; at the END of it into return 0;
That is the end, when i add a return 0; under it, it gives me a error -
Code:
error 010: invalid function or declaration
Code:
dcmd_buildmenu(playerid,params[])
{
	#pragma unused params
	if(PlayerInfo[playerid][pAdmin] >= 1)
 	{
		if(RaceBuilders[playerid] == 0)
		{
			SendClientMessage(playerid, COLOR_GREY, "[Error] You are not building a race");
			return 1;
		}
		if(BAirrace[b(playerid)] == 0) SetMenuColumnHeader(MBuild,0,"Air race: Off");
		else SetMenuColumnHeader(MBuild,0,"Air race: On");
		if(!IsValidMenu(MBuild)) CreateRaceMenus();
		TogglePlayerControllable(playerid,0);
		ShowMenuForPlayer(MBuild,playerid);
		return 1;
	}
	else
	{
	SendClientMessage(playerid, COLOR_WHITE, "[Error] Unknown Command.");
	}
	return 1;
}
	return 0;
}
Any help?
Reply
#9

this is what you're looking for

pawn Code:
public OnPlayerCommandText(playerid,cmdtext)
{
  dcmd(pickles,cmdtext);
  dcmd(lolz,cmdtext);
  dcmd(hamburger,cmdtext);
  dcmd(commands,cmdtext);
  return 1;//<-- this should be return 0;
}
Reply
#10

And the frames are textdraw's
Reply
#11

how do i insert those frames?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)