What's the code for..
#1

I know it's out there some where, but I can't seem to find it. Basically, I'm after the code to send a global message.

I want it so like.. When someone uses "/sethp 100" a message will come up letting the whole server know that said player has done it.

+REP to the 1st guy that gives me it!
Reply
#2

Use SendClientMessageToAll
Reply
#3

Top man, thanks.
Reply
#4

hmm let's see try sendclientmessagetoall
Reply
#5

i also want this thanx
Reply
#6

ZCMD

pawn Код:
{ //Now, we will be needing a user variable for the Player ID, and a Integer variable for the amount.
    new player, health, string[128], administrator[MAX_PLAYER_NAME];
    if(!sscanf(params, "ui", player, health))
    {
        if(player != INVALID_PLAYER_ID)
        {
            if(SInfo[playerid][pAdmin] >= 0)
            {
                GetPlayerName(playerid, administrator, sizeof(administrator));
                SetPlayerHealth(player, health);
                format(string, sizeof(string), "[ADMIN]: Player ID %d's HP has been set to %d by %s.", player, health, administrator);
SendClientMessageToAll(0xDEEE20FF, string);
                AChat(ADMIN, string, 1); //Broadcasts a message to every administrator.
                printf(string);
            }
            else return SendClientMessage(playerid, ROJO, "[Command not found on GTACNR , use /cmds or /commands to see it ]"); //If you're not an Administrator it will send you this client message.
        }
        else return SendClientMessage(playerid, ROJO, "[ERROR]: That user ID is not connected."); //If you enteROJO an INVALID_PLAYER_ID, it will send you this client message.
    }
    else return SendClientMessage(playerid, CELESTE, "[USAGE]: /SetHP [Player ID/Part of Name] [Amount]"); //If you enteROJO the wrong syntax, it will send you this, telling you the exact syntax.
    return 1; //Always include a return 1; after the syntax, or you will get "SERVER: Unknown Command."
}
Reply
#7

I don't have any admin stuff on my server, it's just going to be ran from my computer for a few friends to mess about on with me really, and to learn more about scripting. I've just added "SendClientMessageToAll" and well.. I'm having some problems with it.

Quote:

if(strcmp("/sethp 100", cmdtext, true))
{
SetPlayerHealth(playerid, 100);
SendClientMessage(playerid, 0xAFAFAFAA, "(MESSAGE) You have just set your HP to 100");
SendClientMessageToAll(playerid, 0xAFAFAFAA "(MESSAGE) Has just set their HP to 100!");
return 1;
}

Quote:

C:\Users\Jonesy\Desktop\SA-MP scripting\gamemodes\bare.pwn(45) : error 035: argument type mismatch (argument 2)
C:\Users\Jonesy\Desktop\SA-MP scripting\gamemodes\bare.pwn(45) : warning 215: expression has no effect
C:\Users\Jonesy\Desktop\SA-MP scripting\gamemodes\bare.pwn(45) : error 001: expected token: ";", but found ")"
C:\Users\Jonesy\Desktop\SA-MP scripting\gamemodes\bare.pwn(45) : error 029: invalid expression, assumed zero
C:\Users\Jonesy\Desktop\SA-MP scripting\gamemodes\bare.pwn(45) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

Reply
#8

PHP код:
if(strcmp("/sethp 100"cmdtexttrue))
{
SetPlayerHealth(playerid100);
SendClientMessage(playerid0xAFAFAFAA"(MESSAGE) You have just set your HP to 100.");
format(stringsizeof(string), "(MESSAGE) %s Has just set his health to 100.");
SendClientMessageToAll(0xAFAFAFAAstring);
return 
1;

Reply
#9

Which is role 45?
Reply
#10

Still get these errors mate.

Quote:

C:\Users\Jonesy\Desktop\SA-MP scripting\gamemodes\bare.pwn(45) : error 017: undefined symbol "string"
C:\Users\Jonesy\Desktop\SA-MP scripting\gamemodes\bare.pwn(45) : error 017: undefined symbol "string"
C:\Users\Jonesy\Desktop\SA-MP scripting\gamemodes\bare.pwn(45) : error 029: invalid expression, assumed zero
C:\Users\Jonesy\Desktop\SA-MP scripting\gamemodes\bare.pwn(45) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

That's after compiling this:

Quote:

if(strcmp("/sethp 100", cmdtext, true))
{
SetPlayerHealth(playerid, 100);
SendClientMessage(playerid, 0xAFAFAFAA, "(MESSAGE) You have just set your HP to 100.");
format(string, sizeof(string), "(MESSAGE) %s Has just set his health to 100.");
SendClientMessageToAll(0xAFAFAFAA, string);
return 1;
}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)