Extra in forward/public?
#1

Hello,
Just say'in i want learn something about this..
Is that possible, like:
Код:
forward messageforplayer(playerid, const string[]);

public messageforplayer(playerid, const string[])
{
return sendclientmessage(playerid, -1, string);
}
and can use 2 method's:
Код:
1: messageforplayer(playerid, "Hello");
2: messageforplayer(playerid, "Hello, my ID is %d", playerid);
Just i want use without format, if that's possible and how..?
Reply
#2

I hope this hints for you an answer,

your first way "the one without 'format'" might work, and there are many ways...

pawn Код:
SendMessage(playerid, color, const string[])
{
    SendClientMessage(playerid, color, string);
    return 1;
}
see ^^ it's the same, there are many ways, "You can also place here the color you like"
Reply
#3

Paste this on your gamemode

pawn Код:
stock SendClientMessageEx( playerid, color, const szFormat[ ], { Float, _ }:... )
{
    iArgCount = ( numargs( ) - 3 ) * 4;

    if ( !iArgCount )
        SendClientMessage( playerid, color, szFormat );
    else
    {

        #emit CONST.alt     szFormat
        #emit LCTRL         5
        #emit ADD
        #emit STOR.S.pri    iArgStart
        #emit LOAD.S.alt    iArgCount
        #emit ADD
        #emit STOR.S.pri    iArgEnd

        do
        {
            #emit LOAD.I
            #emit PUSH.pri

            iArgEnd -= 4;

            #emit LOAD.S.pri    iArgEnd
        }
        while ( iArgEnd > iArgStart );

        #emit PUSH.S    szFormat
        #emit PUSH.C    128
        #emit PUSH.ADR  szString

        iArgCount += 12;

        #emit PUSH.S    iArgCount
        #emit SYSREQ.C  format

        iArgCount += 4;

        #emit LCTRL         4
        #emit LOAD.S.alt    iArgCount
        #emit ADD
        #emit SCTRL         4

        SendClientMessage( playerid, color, szString );
    }
    return 1;
}
Then replace SendClientMessage(...) with SendClientMessageEx(...);
Reply
#4

can you explain what have you just did in that code above? "I'm too interested to know"
Reply
#5

Quote:
Originally Posted by Youice
Посмотреть сообщение
I hope this hints for you an answer,

your first way "the one without 'format'" might work, and there are many ways...

pawn Код:
SendMessage(playerid, color, const string[])
{
    SendClientMessage(playerid, color, string);
    return 1;
}
see ^^ it's the same, there are many ways, "You can also place here the color you like"
Nope. That wasn't answer for my question.

TheArcher, still doesn't work.. or what's problem..

It will show this: error 035: argument type mismatch (argument 1)

When i try, like:
Код:
SendClientMessageEx( playerid, -1, "My ID is %d", playerid);
Reply
#6

Any know is that possible or not? I've ******d about that, still haven't found answer.. Like using function without format(...);
Reply
#7

I used y_va by ****** to do this. You can get it here http://pastebin.com/ALDi7hqC.

If you get errors when including it just remove it because some of ******' other includes already add this.

This is how you would make a SendClientMessageEx from this:

pawn Код:
SendClientMessageEx(playerid, color, msg[], va_args<>)
{
    new string[128];
    va_format(string, sizeof(string), msg, va_start<3>);
    return SendClientMessage(playerid, color, string);
}

va_args<> should be the last arguement in the function you want to do this for. va_format should be used on a new variable and the third arguement should be the message that you want to format. The last arguement should be va_start<arguement number where va_args is minus 1>. va_args<> is the fourth arguement here so subtract that by one and you get three, which is why it's va_start<3>. Then you just execute the normal function using the variable you created.
Reply
#8

Hmm.. wierd.

Код:
error 035: argument type mismatch (argument 1)
Код:
MsgForPlayerEx("Found the entrance - ID %d",a); // here error 035
Код:
error 035: argument type mismatch (argument 3)
Код:
MsgForPlayerEx(playerid, const ftext[], va_args<>)
{
	new string[128];
	va_format(string, sizeof(string), ftext, va_start<3>); // here error 035
	return SendClientMessage(playerid, -1, string);
}
Reply
#9

Try this one..
http://forum.sa-mp.com/showpost.php?...&postcount=149
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)