#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;
}
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... |
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; }
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;
|
error 010: invalid function or declaration
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; }
public OnPlayerCommandText(playerid,cmdtext)
{
dcmd(pickles,cmdtext);
dcmd(lolz,cmdtext);
dcmd(hamburger,cmdtext);
dcmd(commands,cmdtext);
return 1;//<-- this should be return 0;
}