[HELP] Small Helping with strings
#1

This is my command..


pawn Код:
CMD:asay(playerid, params[])
{
    new string[128];
    if(PlayerInfo[playerid][pAdmin] < 99999) {
        SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
        return 1;
    }

    format(string, sizeof(string), "** Server Administrator %s: %s **", GetPlayerNameEx(playerid));
    SendClientMessageToAll(COLOR_REALRED, string);
    return 1;
}
On this line:
pawn Код:
format(string, sizeof(string), "** Server Administrator %s: %s **", GetPlayerNameEx(playerid));
How do i make it so its like Server Administrator [Name] : [message] ?

As you can see it only has GetPlayerNameEx(playerid)

..


Regards
Oscii
Reply
#2

pawn Код:
CMD:asay(playerid, params[])
{
    new string[128];
    if(PlayerInfo[playerid][pAdmin] < 99999) {
        SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
        return 1;
    }

        new messagestring[] = "Message";
    format(string, sizeof(string), "** Server Administrator %s: %s **", GetPlayerNameEx(playerid),messagestring);
    SendClientMessageToAll(COLOR_REALRED, string);
    return 1;
}

That should do. I might be wrong due to it's 1am over here but, it should work.
Reply
#3

That kinda works.. But it says


Server Administrator Oscii : Message


Just said 'Oscii' for example name :P
Reply
#4

Well what do you want the message to be?

at
pawn Код:
new messagestring[] = "Message";
you can replace the "Message" with whatever you want it to be.
Reply
#5

OH!!, i see.


cant i make it to what i want it like

USAGE: /asay [text]
Reply
#6

God, just insert params instead of messagestring. Get rid of that declaration.
Reply
#7

format(string, sizeof(string), "** Server Administrator %s: %s **", GetPlayerNameEx(playerid), params);

params is what comes after the command

EDIT: As vince said above.. Sorry my internet is running at a snails pace
Reply
#8

NOT sscanf, but ZCMD
Reply
#9

Meh if your refering to me, I was explaining what params was and what other functions params needs to seperate this I gave the simpleest form. I didnt explain it well so I removed it as he doesnt need it for a string anyway!. Which I made clear in my explaination which is now gone
Reply
#10

Quote:
Originally Posted by IceCube!
Посмотреть сообщение
Meh if your refering to me, I was explaining what params was and what other functions params needs to seperate this I gave the simpleest form. I didnt explain it well so I removed it as he doesnt need it for a string anyway!. Which I made clear in my explaination which is now gone
Thank you very much..

It worked!


+1rep'd
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)