Удаление строки audio stream
#11

Честно сказать - затея не очень хорошая.
Исправил код, не много оптимизировал.
pawn Код:
//============================================================================//
//Include
#if !defined _SCM_
#define _SCM_

#include <a_samp>
#define MAX_MESSAGES 100
#define MAX_MESSAGE_LENGHT (144 + MAX_PLAYER_NAME + 16)

enum SCM_Data
{
    SCM_Text[MAX_MESSAGE_LENGHT],
    SCM_Color
};
new SCM_Page[MAX_PLAYERS + 1][MAX_MESSAGES][SCM_Data], SCM_Counter[MAX_PLAYERS];

stock SCM_SendClientMessage(playerid, color, text[])
{
    format( SCM_Page[playerid][SCM_Counter[playerid]][SCM_Text], MAX_MESSAGE_LENGHT, "%s", text);
    SendClientMessage(playerid, (SCM_Page[playerid][SCM_Counter[playerid]][SCM_Color] = color), SCM_Page[playerid][SCM_Counter[playerid]][SCM_Text] );
    if((++SCM_Counter[playerid]) == MAX_MESSAGES) SCM_Counter[playerid] = 0;
    return 1;
}

stock SCM_SendClientMessageToAll(color, text[])
{
    format( SCM_Page[MAX_PLAYERS][0][SCM_Text], MAX_MESSAGE_LENGHT, "%s", text);
    SCM_Page[MAX_PLAYERS][0][SCM_Color] = color;
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
        SCM_Page[playerid][SCM_Counter[playerid]] = SCM_Page[MAX_PLAYERS][0];
        if((++SCM_Counter[playerid]) == MAX_MESSAGES) SCM_Counter[playerid] = 0;
    }
    SendClientMessageToAll(color, text);
    return 1;
}

stock SCM_ClearChat(playerid, no_msg = 0)
{
    SCM_Page[playerid] = SCM_Page[MAX_PLAYERS];
    SCM_Counter[playerid] = 0;
    if(no_msg == 0)
    {
        for(new i = 0; i < MAX_MESSAGES; i++) SendClientMessage(playerid, SCM_Page[playerid][i][SCM_Color], SCM_Page[playerid][i][SCM_Text]);
    }
}

stock SCM_PlayAudioStreamForPlayer(playerid, url[], Float:PosX = 0.0, Float:PosY = 0.0, Float:PosZ = 0.0, Float:Distance = 50.0, Usepos = 0)
{
    PlayAudioStreamForPlayer(playerid, url, PosX, PosY, PosZ, Distance, Usepos);
    for(new i = SCM_Counter[playerid]; i < MAX_MESSAGES; i++) SendClientMessage(playerid, SCM_Page[playerid][SCM_Counter[playerid]][SCM_Color], SCM_Page[playerid][SCM_Counter[playerid]][SCM_Text]);
    for(new i = 0; i < SCM_Counter[playerid]; i++) SendClientMessage(playerid, SCM_Page[playerid][i][SCM_Color], SCM_Page[playerid][i][SCM_Text]);
    return 1;
}

#define ClearChat SCM_ClearChat
#define SendClientMessage SCM_SendClientMessage
#define SendClientMessageToAll SCM_SendClientMessageToAll
#define PlayAudioStreamForPlayer SCM_PlayAudioStreamForPlayer

#endif
//============================================================================//
//GameMode

public OnPlayerConnect(playerid)
{
    ClearChat(playerid, 1);
    return 1;
}

public OnPlayerText(playerid, text[])
{
    new p_Name[MAX_PLAYER_NAME], p_Text[MAX_MESSAGE_LENGHT];
    GetPlayerName(playerid, p_Name, MAX_PLAYER_NAME);
    format( p_Text, MAX_MESSAGE_LENGHT, "%s: {FFFFFF}%s", p_Name, text);
    SendClientMessageToAll((GetPlayerColor(playerid) >>> 8), p_Text);
    //------                        TEST                                ------//
    if(text[0] == '1')
    {
        SCM_PlayAudioStreamForPlayer(playerid, "http://is-team.clan.su/Update/Sub-Mass-Histerics.mp3");
    }
    if(text[0] == '2')
    {
        SCM_SendClientMessage(playerid, 0x00FF00FF, "ololo123");
        SCM_SendClientMessage(playerid, 0x00FF00FF, "ololo");
    }
    if(text[0] == '3')
    {
        SCM_SendClientMessageToAll(0xFF0000FF, "G_ololo123");
        SCM_SendClientMessageToAll(0xFF0000FF, "G_ololo");
    }
    //------------------------------------------------------------------------//
    return 0;
}
Reply


Messages In This Thread
Удаление строки audio stream - by Кирилл - 07.12.2014, 13:58
Re: Удаление строки audio stream - by DartfoL - 07.12.2014, 14:04
Re: Удаление строки audio stream - by Кирилл - 07.12.2014, 14:06
Re: Удаление строки audio stream - by DartfoL - 07.12.2014, 14:08
Re: Удаление строки audio stream - by Кирилл - 07.12.2014, 14:13
Re: Удаление строки audio stream - by ope - 07.12.2014, 15:05
Re: Удаление строки audio stream - by Кирилл - 07.12.2014, 15:07
Re: Удаление строки audio stream - by DartfoL - 07.12.2014, 16:48
Re: Удаление строки audio stream - by sampsvr - 07.12.2014, 16:58
Re: Удаление строки audio stream - by OKStyle - 07.12.2014, 18:15
Re: Удаление строки audio stream - by White_116 - 07.12.2014, 22:32
Re: Удаление строки audio stream - by DrumYum - 08.12.2014, 06:00
Re: Удаление строки audio stream - by Stepashka - 08.12.2014, 07:59
Re: Удаление строки audio stream - by SoNikMells - 08.12.2014, 13:49
Re: Удаление строки audio stream - by OKStyle - 08.12.2014, 14:11
Re: Удаление строки audio stream - by stabker - 08.12.2014, 17:00
Re: Удаление строки audio stream - by OKStyle - 09.12.2014, 04:21
Re: Удаление строки audio stream - by ope - 14.12.2014, 14:38
Re: Удаление строки audio stream - by SyneR - 03.01.2015, 13:57
Re: Удаление строки audio stream - by kennydalglish - 04.01.2015, 23:28
Re: Удаление строки audio stream - by OKStyle - 05.01.2015, 04:47
Re: Удаление строки audio stream - by ope - 05.01.2015, 10:14
Re: Удаление строки audio stream - by 7Zip - 05.01.2015, 10:24

Forum Jump:


Users browsing this thread: 1 Guest(s)