Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // OOC Chat by 946ben
- #include <a_samp>
- #define COLOR_GREY 0xAAAAAAFF
- #define COLOR_WHITE 0xFFFFFFFF
- #define COLOR_RED 0xB90000FF
- #define COLOR_YELLOW 0xFFFF00FF
- new ooc = 0;
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" OOC Chat by 946ben ");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- new sender[MAX_PLAYER_NAME], Float:x, Float:y, Float:z;
- GetPlayerName(playerid, sender, sizeof(sender));
- GetPlayerPos(playerid, x, y, z);
- format(text, 128, "%s sagt: %s", sender, text);
- for(new player=0; player<MAX_PLAYERS; player++)
- {
- if(IsPlayerConnected(player))
- {
- if(IsPlayerInRangeOfPoint(player,20.0,x,y,z))
- {
- SendClientMessage(player,COLOR_GREY,text);
- }
- }
- }
- return 0;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp(strget(cmdtext, 0), "/o"))
- {
- if(ooc == 1)
- {
- new player[MAX_PLAYER_NAME];
- new t[180];
- GetPlayerName(playerid, player, sizeof(player));
- format(t, sizeof(t), "((%s: %s))", player, cmdtext[3]);
- SendClientMessageToAll(COLOR_WHITE, t);
- return 1;
- } else {
- return SendClientMessage(playerid, COLOR_RED, "Der OOC-Chat ist abgeschaltet");
- }
- }
- if(!strcmp(strget(cmdtext, 0), "/ooc"))
- {
- if(IsPlayerAdmin(playerid))
- {
- if(ooc == 1)
- {
- ooc = 0;
- SendClientMessageToAll(COLOR_YELLOW, "Der OOC-Chat wurde abgeschaltet");
- } else {
- ooc = 1;
- SendClientMessageToAll(COLOR_YELLOW, "Der OOC-Chat wurde angeschaltet");
- }
- return 1;
- } else {
- return SendClientMessage(playerid, COLOR_RED, "Du hat keine Berechtigung");
- }
- }
- return 0;
- }
- //-----------------strget---------------
- stock strget(strx[], pos, search = ' ') {
- new arg, ret[128], idxx;
- for (new i = 0; i < strlen(strx); i++) {
- if(strx[i] == search || i == strlen(strx) || strx[i + 1] == 10) {
- arg++;
- if (arg == pos + 1){
- ret[i-idxx] = EOS;
- return ret;
- } else if (arg == pos)
- idxx= i+1;
- }
- else if (arg == pos)
- ret[i - idxx] = strx[i];
- }
- return ret;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement