Basic scripting question.
#2

Global OOC Chat:
pawn Код:
public OnPlayerText(playerid, text[])
{
    new string [128];
    GetPlayerName(playerid, string, sizeof(string));
    format(string, sizeof(string), "(( %s says: %s)) ", string, text);
    SendClientMessageToAll(playerid, 0xFFFFFFFF, string);
    return 1;
}
OOC Local Chat:
pawn Код:
if(strcmp(string, "/lo", true) == 0)
    {
        object = strlen(cmdtext);
        while ((idx < object) && (cmdtext[idx] <= ' '))
        {
            idx++;
        }
        new offset = idx;
        new result[64];
        while ((idx < object) && ((idx - offset) < (sizeof(result) - 1)))
        {
            result[idx - offset] = cmdtext[idx];
            idx++;
        }
        result[idx - offset] = EOS;
        if(!strlen(result))
        {
            SendClientMessage(playerid, COLOR_GREY, "USAGE: /lo [chat]");
            return 1;
        }
        GetPlayerName(playerid, playername, sizeof(playername));
        format(string, sizeof(string), "((%s says: %s))", playername, result);
        ProxDetector(20.0, playerid, string, COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);      printf(string);
    }
IC Local Chat:
pawn Код:
if(strcmp(string, "/li", true) == 0)
    {
        object = strlen(cmdtext);
        while ((idx < object) && (cmdtext[idx] <= ' '))
        {
            idx++;
        }
        new offset = idx;
        new result[64];
        while ((idx < object) && ((idx - offset) < (sizeof(result) - 1)))
        {
            result[idx - offset] = cmdtext[idx];
            idx++;
        }
        result[idx - offset] = EOS;
        if(!strlen(result))
        {
            SendClientMessage(playerid, COLOR_GREY, "USAGE: /li [chat]");
            return 1;
        }
        GetPlayerName(playerid, playername, sizeof(playername));
        format(string, sizeof(string), "%s says: %s", playername, result);
        ProxDetector(20.0, playerid, string, COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);      printf(string);
    }
Reply


Messages In This Thread
Basic scripting question. - by steve_gibson - 10.07.2011, 23:31
Re: Basic scripting question. - by Adil - 10.07.2011, 23:36
Re: Basic scripting question. - by steve_gibson - 10.07.2011, 23:41
Re: Basic scripting question. - by Adil - 10.07.2011, 23:47
Re: Basic scripting question. - by steve_gibson - 10.07.2011, 23:51
Re: Basic scripting question. - by steve_gibson - 10.07.2011, 23:55
Re: Basic scripting question. - by Adil - 10.07.2011, 23:59
Re: Basic scripting question. - by steve_gibson - 11.07.2011, 00:08
Re: Basic scripting question. - by Adil - 11.07.2011, 00:47
Re: Basic scripting question. - by =WoR=Varth - 11.07.2011, 00:49

Forum Jump:


Users browsing this thread: 6 Guest(s)