Admin message
#1

I know the command /rcon say text but how to send a message to all that looks like a GameTextForPlayer?
like this

its color is usually orange
Reply
#2

explain, theres 1701251534 texts there??
Reply
#3

I dont understand your question?
Reply
#4

Do you know the admin command

/rcon say ?

well, isn't there a command wich works the same way but shows a BIG message in the middle of the screen?
Reply
#5

He wants an announce command for admins

pawn Код:
if( !strcmp(cmdtext, "/announce", true ))
{
    if( strlen( cmdtext ) < 11 )
        return false;
    new
        gText[ 128 ];
    format( gText, sizeof( gText ), "%s", cmdtext[ 10 ] );
    GameTextForAll( gText, 3, 5000 );
    return true;
}
Simple
Reply
#6

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if( !strcmp(cmdtext, "/announce", true ))
{
    if( strlen( cmdtext ) < 11 )
        return false;
    new
        gText[ 128 ];
    format( gText, sizeof( gText ), "%s", cmdtext[ 10 ] );
    GameTextForAll( gText, 3, 5000 );
    return true;
}
    new string[256];
    new playermoney;
    new sendername[MAX_PLAYER_NAME];
    new giveplayer[MAX_PLAYER_NAME];
    new cmd[256];
    new giveplayerid, moneys, idx;

    cmd = strtok(cmdtext, idx);

    if(strcmp(cmd, "/help", true) == 0) {
        SendPlayerFormattedText(playerid,"Las Venturas Deathmatch: Money Grub Coded By Jax and the SA-MP Team.",0);
        SendPlayerFormattedText(playerid,"Type: /objective : to find out what to do in this gamemode.",0);
        SendPlayerFormattedText(playerid,"Type: /givecash [playerid] [money-amount] to send money to other players.",0);
        SendPlayerFormattedText(playerid,"Type: /tips : to see some tips from the creator of the gamemode.", 0);
  return 1;
    }
    if(strcmp(cmd, "/objective", true) == 0) {
        SendPlayerFormattedText(playerid,"This gamemode is faily open, there's no specific win / endgame conditions to meet.",0);
        SendPlayerFormattedText(playerid,"In LVDM:Money Grub, when you kill a player, you will receive whatever money they have.",0);
        SendPlayerFormattedText(playerid,"Consequently, if you have lots of money, and you die, your killer gets your cash.",0);
        SendPlayerFormattedText(playerid,"However, you're not forced to kill players for money, you can always gamble in the", 0);
        SendPlayerFormattedText(playerid,"Casino's.", 0);
  return 1;
    }
    if(strcmp(cmd, "/tips", true) == 0) {
        SendPlayerFormattedText(playerid,"Spawning with just a desert eagle might sound lame, however the idea of this",0);
        SendPlayerFormattedText(playerid,"gamemode is to get some cash, get better guns, then go after whoever has the",0);
        SendPlayerFormattedText(playerid,"most cash. Once you've got the most cash, the idea is to stay alive(with the",0);
        SendPlayerFormattedText(playerid,"cash intact)until the game ends, simple right?", 0);
  return 1;
    }

    if(strcmp(cmd, "/givecash", true) == 0) {
      new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
            return 1;
        }
        giveplayerid = strval(tmp);

        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
            return 1;
        }
        moneys = strval(tmp);

        //printf("givecash_command: %d %d",giveplayerid,moneys);


        if (IsPlayerConnected(giveplayerid)) {
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            playermoney = GetPlayerMoney(playerid);
            if (moneys > 0 && playermoney >= moneys) {
                GivePlayerMoney(playerid, (0 - moneys));
                GivePlayerMoney(giveplayerid, moneys);
                format(string, sizeof(string), "You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
                SendClientMessage(playerid, COLOR_YELLOW, string);
                format(string, sizeof(string), "You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
                SendClientMessage(giveplayerid, COLOR_YELLOW, string);
                printf("%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
            }
            else {
                SendClientMessage(playerid, COLOR_YELLOW, "Invalid transaction amount.");
            }
        }
        else {
                format(string, sizeof(string), "%d is not an active player.", giveplayerid);
                SendClientMessage(playerid, COLOR_YELLOW, string);
            }
        return 1;
    }


    return 0;
}

/announce = unknown command

even when i am logged as admin
Reply
#7

Use "/announce text". You have to use the text you want to announce followed by the command.
Reply
#8

The problem is that "/announce is "unknown command" for the server!
Reply
#9

Oh I see. try this: (Only add what you do not already have. If you need strtok - https://sampwiki.blast.hk/wiki/strtok)
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[256], tmp[256]; idx;
  cmd = strtok(cmdtext, idx);
  if(strcmp(cmd, "/announce", true) == 0)
  {
   tmp = strtok(cmdtext, idx);
   if(!strlen(tmp)) return 0;
   new gText[128];
   format(gText, sizeof(gText), "%s", tmp);
   GameTextForAll(gText, 3, 5000);
   return 1;
  }
  return 0;
}
Reply
#10

I cba to use strtok...
Anyways, my fault is that the length check should be < 10 not < 11 * my bad *
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)