Command Bug
#1

Hello i would like someone to take a look on my command since it keeps repeating "This player has already been offered a live conversation"


if anyone nows whats wrong please share your knowledge


Код:
CMD:live(playerid, params[])
{
	new string[128], playerb;
	if(!IsAReporter(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not a news reporter.");
	if(Live[playerid])
	{
	    foreach(Player, i)
	    {
	        if(Live[i] && i != playerid) playerb = i;
	    }
	    Live[playerid] = 0;
	    Live[playerb] = 0;
	    LiveConference = 0;
	    SendClientMessage(playerid, COLOR_LIGHTRED, "You have ended the live news conference.");
	    SendClientMessage(playerb, COLOR_LIGHTRED, "The live news conference has ended.");
	}
	else
	{
	    if(LiveRequest[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You have already offered someone a live news conference.");
	    if(LiveConference) return SendClientMessage(playerid, COLOR_GREY, "Another live news conference is already being held.");
		if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /live [playerid]");
		if(playerb == playerid) return SendClientMessage(playerid, COLOR_GREY, "You can't offer yourself to a live news conference.");
		if(LiveBy[playerb] != -1) return SendClientMessage(playerid, COLOR_GREY, "Player has been already offered a live news conference.");
		LiveBy[playerb] = playerid;
		LiveRequest[playerid] = 1;
		format(string, sizeof(string), " You have offered %s a live news conference.", RPN(playerb));
		SendClientMessage(playerid, COLOR_LIME, string);
		format(string, sizeof(string), " News Reporter %s has offered you a live news conference. (/accept live) (/cancel live)", RPN(playerid));
		SendClientMessage(playerb, COLOR_LIME, string);
	}
	return 1;
}
Accept command
Код:
CMD:accept1(playerid, params[])
{
	new id, string[128];
	if(!PlayerIsOn(id)) return NotConnectedMSG(playerid);
	if(sscanf(params, "s[128]", params))
	{
		SendClientMessage(playerid, COLOR_WHITE, "USAGE: /accept [option]");
		SendClientMessage(playerid, COLOR_GREY, "OPTIONS: Live");
		return 1;
	}
	if(!strcmp(params, "live", true))
	{
		new playerb = LiveBy[playerid];
		if(playerb == -1) return SendClientMessage(playerid, COLOR_GREY, "Nobody has offered you a live news conference.");
		LiveBy[playerid] = -1;
		LiveRequest[playerb] = 0;
		Live[playerid] = 1;
		Live[playerb] = 1;
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are now on air, you can speak on live news using your normal chat.");
		SendClientMessage(playerb, COLOR_LIGHTBLUE, "You are now on air, you can speak on live news using your normal chat. (/live to end the conference)");
	}
	return 1;
}
Stocks
Код:
stock IsAReporter(playerid)
{
	if(PlayerInfo[playerid][pFaction] == 4) return 1;
	return 0;
}
Код:
stock RPN(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    for(new i = 0; i < MAX_PLAYER_NAME; i++)
    {
        if(name[i] == '_') name[i] = ' ';
    }
    return name;
}
Reply
#2

Under OnPlayerConnect:

pawn Код:
LiveBy[playerid] = -1;
LiveRequest[playerid] = 0;
Live[playerid] = 0;
Reply
#3

Thanks alot man!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)