Not performing correctly (Commands)
#8

The issue is caused by a flaw in "InGameChatRemoveUnderscore(playerid)".

pawn Код:
// [ DEVELOPMENT GAMEMODE ]

// INCLUDES:

#include <a_samp>
#include <zcmd>

// DEFINES:

#define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))

// MAIN:

main()
{
    print("Development Mode: rp_name.amx");
}

// CALLBACKS:

public OnGameModeInit()
{  
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

// COMMANDS:

CMD:b(playerid, params[])
{
    new string[144];
    if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /b (message).");

    format(string, sizeof(string), "%s: (( %s ))", ReplaceString("_", " ", PlayerName(playerid)), params);
    SendClientMessageToAll(-1, string);
    return 1;
}

// FUNCTIONS:

stock PlayerName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    return name;
}

stock ReplaceString(search[], replace[], source[])
{
    new string[256], length;
    for(new i = 0; i < strlen(source); i ++)
    {
        if(strlen(search) > 1 && i != (strlen(source) - 1))
        {
            new bool:match = false, start = i;
            for(new j = 0; j < strlen(search) && !match; j ++)
            {
                if(source[i] != search[j] && j == 0)
                {
                    string[length] = source[i];
                    match = true;
                }
                else
                {
                    if(source[i] == search[j]) i ++;
                    else match = true;
                }
            }

            if(match == true)
            {
                while(start <= i)
                {
                    string[length] = source[start];
                    length ++;
                    start ++;
                }
            }
            else
            {
                for(new j; j < strlen(replace); j ++)
                {
                    string[length] = replace[j];
                    length ++;
                }

                i = (start + (strlen(search) - 1));
            }
        }
        else
        {
            if(strlen(search) == 1 && source[i] == search[0])
            {
                for(new j; j < strlen(replace); j ++)
                {
                    string[length] = replace[j];
                    length ++;
                }
            }
            else
            {
                string[length] = source[i];
                length ++;
            }
        }
    }

    string[length] = EOS;
    return string;
}
Reply


Messages In This Thread
[SOLVED]Not performing correctly (Commands) - by Sime30 - 06.07.2015, 15:25
Re: Not performing correctly (Commands) - by SickAttack - 06.07.2015, 15:39
Re: Not performing correctly (Commands) - by JaydenJason - 06.07.2015, 15:42
Re: Not performing correctly (Commands) - by Sime30 - 06.07.2015, 15:44
Re: Not performing correctly (Commands) - by SickAttack - 06.07.2015, 15:45
Re: Not performing correctly (Commands) - by Sime30 - 06.07.2015, 15:57
Re: Not performing correctly (Commands) - by Sime30 - 06.07.2015, 20:16
Re: Not performing correctly (Commands) - by SickAttack - 06.07.2015, 22:14
Re: Not performing correctly (Commands) - by Sime30 - 06.07.2015, 22:30
AW: Not performing correctly (Commands) - by Kaliber - 06.07.2015, 22:44

Forum Jump:


Users browsing this thread: 1 Guest(s)