How to create a Textdraw /ad
#1

Hello,

I've made a textdraw and I want it to show every /ad that comes from any player for example:

If a player wants to sell his car,

/ad Selling a real awesome car.

[ADVERTISMENT]PLAYERNAME is selling a real awesome car.

but I want it to create a textdraw message with the clientmessage says Selling a real Awesome car.



Look at the textdraw bar on the bottom of the screen. I want every /ad to be sent on it. How can I do this ? Thanks in advance!
Reply
#2

Post the TextDrawCreate "string" for that bar.

Err, just try this(Modify it to fit your system):
pawn Код:
CMD:ad(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /Ad < Message >");

    new
        iStr[80],
        iName[MAX_PLAYER_NAME];

    GetPlayerName(playerid, iName, sizeof(iName));

    format(iStr, sizeof(iStr), "%s - %s", iName, params); // Will show like: "PlayerName - Selling a car"
    TextDrawSetString(Textdraw7, iStr);
    TextDrawShowForAll(Textdraw7); // Comment if you are already showing the textdraw
    return 1;
}
Reply
#3

Could you do that for me, because I don't know how :$

And here is the whole code:
pawn Код:
/*
Filterscript generated using Zamaroht's TextDraw Editor Version 1.0.
Designed for SA-MP 0.3a.

Time and Date: 2011-9-21 @ 18:18:53

Instructions:
1- Compile this file using the compiler provided with the sa-mp server package.
2- Copy the .amx file to the filterscripts directory.
3- Add the filterscripts in the server.cfg file (more info here:
https://sampwiki.blast.hk/wiki/Server.cfg)
4- Run the server!

Disclaimer:
You have full rights over this file. You can distribute it, modify it, and
change it as much as you want, without having to give any special credits.
*/


#include <a_samp>

new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
new Text:Textdraw3;
new Text:Textdraw4;
new Text:Textdraw5;
new Text:Textdraw6;
new Text:Textdraw7;

public OnFilterScriptInit()
{
    print("Textdraw file generated by");
    print("    Zamaroht's textdraw editor was loaded.");

    // Create the textdraws:
    Textdraw0 = TextDrawCreate(544.000000, 29.000000, "Los Santos");
    TextDrawBackgroundColor(Textdraw0, 255);
    TextDrawFont(Textdraw0, 1);
    TextDrawLetterSize(Textdraw0, 0.250000, 1.000000);
    TextDrawColor(Textdraw0, -16776961);
    TextDrawSetOutline(Textdraw0, 0);
    TextDrawSetProportional(Textdraw0, 1);
    TextDrawSetShadow(Textdraw0, 1);

    Textdraw1 = TextDrawCreate(549.000000, 37.000000, "Roleplay Gaming");
    TextDrawBackgroundColor(Textdraw1, 255);
    TextDrawFont(Textdraw1, 1);
    TextDrawLetterSize(Textdraw1, 0.200000, 1.000000);
    TextDrawColor(Textdraw1, 16711935);
    TextDrawSetOutline(Textdraw1, 0);
    TextDrawSetProportional(Textdraw1, 1);
    TextDrawSetShadow(Textdraw1, 1);

    Textdraw2 = TextDrawCreate(799.000000, 429.000000, "New Textdraw");
    TextDrawBackgroundColor(Textdraw2, 255);
    TextDrawFont(Textdraw2, 1);
    TextDrawLetterSize(Textdraw2, 0.500000, 1.100000);
    TextDrawColor(Textdraw2, 623919375);
    TextDrawSetOutline(Textdraw2, 0);
    TextDrawSetProportional(Textdraw2, 1);
    TextDrawSetShadow(Textdraw2, 1);
    TextDrawUseBox(Textdraw2, 1);
    TextDrawBoxColor(Textdraw2, -216);
    TextDrawTextSize(Textdraw2, -257.000000, 2.000000);

    Textdraw3 = TextDrawCreate(530.000000, 431.000000, "www.ls-rpg.own0.com");
    TextDrawBackgroundColor(Textdraw3, 255);
    TextDrawFont(Textdraw3, 1);
    TextDrawLetterSize(Textdraw3, 0.270000, 1.100000);
    TextDrawColor(Textdraw3, 16711935);
    TextDrawSetOutline(Textdraw3, 1);
    TextDrawSetProportional(Textdraw3, 1);

    Textdraw4 = TextDrawCreate(1.000000, 426.000000, "Location:");
    TextDrawBackgroundColor(Textdraw4, 255);
    TextDrawFont(Textdraw4, 1);
    TextDrawLetterSize(Textdraw4, 0.230000, 0.899999);
    TextDrawColor(Textdraw4, -1);
    TextDrawSetOutline(Textdraw4, 1);
    TextDrawSetProportional(Textdraw4, 1);

    Textdraw5 = TextDrawCreate(128.000000, 425.000000, "I");
    TextDrawBackgroundColor(Textdraw5, 255);
    TextDrawFont(Textdraw5, 2);
    TextDrawLetterSize(Textdraw5, 0.500000, 2.500000);
    TextDrawColor(Textdraw5, -16776961);
    TextDrawSetOutline(Textdraw5, 1);
    TextDrawSetProportional(Textdraw5, 1);

    Textdraw6 = TextDrawCreate(511.000000, 425.000000, "I");
    TextDrawBackgroundColor(Textdraw6, 255);
    TextDrawFont(Textdraw6, 2);
    TextDrawLetterSize(Textdraw6, 0.500000, 2.500000);
    TextDrawColor(Textdraw6, -16776961);
    TextDrawSetOutline(Textdraw6, 1);
    TextDrawSetProportional(Textdraw6, 1);

    Textdraw7 = TextDrawCreate(164.000000, 433.000000, "Advertisments Bar (( Coming Soon ))");
    TextDrawBackgroundColor(Textdraw7, 255);
    TextDrawFont(Textdraw7, 1);
    TextDrawLetterSize(Textdraw7, 0.500000, 1.000000);
    TextDrawColor(Textdraw7, -1);
    TextDrawSetOutline(Textdraw7, 1);
    TextDrawSetProportional(Textdraw7, 1);

    for(new i; i < MAX_PLAYERS; i ++)
    {
        if(IsPlayerConnected(i))
        {
            TextDrawShowForPlayer(i, Textdraw0);
            TextDrawShowForPlayer(i, Textdraw1);
            TextDrawShowForPlayer(i, Textdraw2);
            TextDrawShowForPlayer(i, Textdraw3);
            TextDrawShowForPlayer(i, Textdraw4);
            TextDrawShowForPlayer(i, Textdraw5);
            TextDrawShowForPlayer(i, Textdraw6);
            TextDrawShowForPlayer(i, Textdraw7);
        }
    }
    return 1;
}

public OnFilterScriptExit()
{
    TextDrawHideForAll(Textdraw0);
    TextDrawDestroy(Textdraw0);
    TextDrawHideForAll(Textdraw1);
    TextDrawDestroy(Textdraw1);
    TextDrawHideForAll(Textdraw2);
    TextDrawDestroy(Textdraw2);
    TextDrawHideForAll(Textdraw3);
    TextDrawDestroy(Textdraw3);
    TextDrawHideForAll(Textdraw4);
    TextDrawDestroy(Textdraw4);
    TextDrawHideForAll(Textdraw5);
    TextDrawDestroy(Textdraw5);
    TextDrawHideForAll(Textdraw6);
    TextDrawDestroy(Textdraw6);
    TextDrawHideForAll(Textdraw7);
    TextDrawDestroy(Textdraw7);
    return 1;
}

public OnPlayerConnect(playerid)
{
    TextDrawShowForPlayer(playerid, Textdraw0);
    TextDrawShowForPlayer(playerid, Textdraw1);
    TextDrawShowForPlayer(playerid, Textdraw2);
    TextDrawShowForPlayer(playerid, Textdraw3);
    TextDrawShowForPlayer(playerid, Textdraw4);
    TextDrawShowForPlayer(playerid, Textdraw5);
    TextDrawShowForPlayer(playerid, Textdraw6);
    TextDrawShowForPlayer(playerid, Textdraw7);
    return 1;
}

And the string of that ( coming soon ) is:

pawn Код:
Textdraw7 = TextDrawCreate(164.000000, 433.000000, "Advertisments Bar (( Coming Soon ))");
    TextDrawBackgroundColor(Textdraw7, 255);
    TextDrawFont(Textdraw7, 1);
    TextDrawLetterSize(Textdraw7, 0.500000, 1.000000);
    TextDrawColor(Textdraw7, -1);
    TextDrawSetOutline(Textdraw7, 1);
    TextDrawSetProportional(Textdraw7, 1);
Reply
#4

One error:

C:\Users\GuitarsRockMe\Downloads\RC5\RC5\withad.pw n(17840) : error 017: undefined symbol "params"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase



1 Error.



Line: format(iStr, sizeof(iStr), "%s - %s", iName, params);
Reply
#5

Alright, changed from params to string but, I wanted it to be like, when a player do the /ad the text that he entered shows on that bar

That's what yours shows:




I want it to show like my first picture, instead of Advertisment bar (( COMING SOON )) I want it to show the string of the /ad ( the text )

Reply
#6

Quote:
Originally Posted by Ehab1911
Посмотреть сообщение
Alright, changed from params to string but, I wanted it to be like, when a player do the /ad the text that he entered shows on that bar

That's what yours shows:

I want it to show like my first picture, instead of Advertisment bar (( COMING SOON )) I want it to show the string of the /ad ( the text )
Err, I did the command to work with "Textdraw7" ( The one containing the advertisement info ). It could be that your textdraws are "Messing up" or I missed something in the command. ;s
Reply
#7

Aha, Alright thank you mate . I will do my best to fix it, else I'll ask you again ^_^. Thank you +rep.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)