SA-MP Forums Archive
[HELP] Small Helping with strings - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] Small Helping with strings (/showthread.php?tid=341496)



[HELP] Small Helping with strings - [FIXED] - Oscii - 10.05.2012

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


Re: [HELP] Small Helping with strings - CrazyGab - 10.05.2012

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.


Re: [HELP] Small Helping with strings - Oscii - 10.05.2012

That kinda works.. But it says


Server Administrator Oscii : Message


Just said 'Oscii' for example name :P


Re: [HELP] Small Helping with strings - CrazyGab - 10.05.2012

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.


Re: [HELP] Small Helping with strings - Oscii - 10.05.2012

OH!!, i see.


cant i make it to what i want it like

USAGE: /asay [text]


Re: [HELP] Small Helping with strings - Vince - 10.05.2012

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


Re: [HELP] Small Helping with strings - IceCube! - 10.05.2012

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


Re: [HELP] Small Helping with strings - milanosie - 10.05.2012

NOT sscanf, but ZCMD


Re: [HELP] Small Helping with strings - IceCube! - 10.05.2012

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


Re: [HELP] Small Helping with strings - Oscii - 11.05.2012

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