http://laska-samp.biz/articles/pawn-book/osnovy-skriptinga/style
°•°•° Проект SAMP - Romashka [0.3e] ™18+™ °•°•° :: Теория :: Pawn :: Введение в скриптинг

Стили текста

Style0

Style1

Style2

Style3

Style4

Style5

Style6

Как нанести надпись на стену?

public OnGameModeInit()
new myobject2 = CreateObject(10671, 1481.2015, -1750.9497, 28.4468, 0.0000, 0.0000, -90.5548);  
SetObjectMaterialText(myobject2, "{ff0000}News", 0, 40, "Arial", 36, 1, -16776961, 0, 1);
 
Система графити

 
    // Graffity System
    // Credits :
    // PabuLetz. - Creator for FilterScripts
    // Gireada - Rezolve an error
    // Acest Graffity System consta in creearea unor tatuaje pe pereti
    // Comenzi:
    // /cgraffity
    // /cremove
    // /graffity


    #define FILTERSCRIPT

    #include <a_samp>
    #include <dini>
    #define COLOR_RED 0xAA3333AA
    //#define COLOR_GRAF1 0xFF0000FF
    #define COLOR_GRAF2 0xFF8000FF
    #define COLOR_GRAF3 0x0000FFFF
    #define COLOR_GRAF4 0x00FF00FF
    #define MAX_GRAFFITI 50
    #define Saver "Graffity/%s.ini"
    new GraffityDone[MAX_PLAYERS];

    #pragma tabsize 0
    new graffity;
    #define MAX_GRAFTEXT (64)
    new GrafText1[MAX_PLAYERS][MAX_GRAFTEXT];
    new GrafText2[MAX_PLAYERS][MAX_GRAFTEXT];
    new GrafText[MAX_PLAYERS][MAX_GRAFTEXT];
    new GrafFont[MAX_PLAYERS];
    new GrafFont1[MAX_PLAYERS];
    new GrafFont2[MAX_PLAYERS];
    new GrafFont3[MAX_PLAYERS];
    new graf[MAX_PLAYERS];
    new text [ 50 ];

    #if defined FILTERSCRIPT

    public OnFilterScriptInit()
    {
        print("\n--------------------------------------");
        print(" Graffity System");
        print("--------------------------------------\n");
        return 1;
    }

    public OnFilterScriptExit()
    {
        return 1;
    }

    #else

    main()
    {
        print("\n----------------------------------");
        print(" GRaffity System");
        print("----------------------------------\n");
    }

    #endif

    public OnGameModeInit()
    {
       
        return 1;
    }

    public OnGameModeExit()
    {
        return 1;
    }

    public OnPlayerRequestClass(playerid, classid)
    {
        return 1;
    }

    public OnPlayerConnect(playerid)
    {
           new file[100],Name[30];
    GetPlayerName(playerid,Name,30);
    format(file,100,Saver,Name);
    if(!dini_Exists(file))
    {
    dini_Create(file);
    dini_IntSet(file,"Graffity Created",GraffityDone[playerid] = 0);
    }
    else
    {
    GraffityDone[playerid] = dini_Int(file,"Graffity Created");
    }
        graf[playerid] = 0;
        return 1;
    }
    public OnPlayerDisconnect(playerid, reason)
    {
            new file[100],Name[30];
    GetPlayerName(playerid,Name,30);
    format(file,100,Saver,Name);
    dini_IntSet(file,"Graffity Created",GraffityDone[playerid]);
        graf[playerid] = 0;
        return 1;
    }

    public OnPlayerSpawn(playerid)
    {
        return 1;
    }

    public OnPlayerDeath(playerid, killerid, reason)
    {
        return 1;
    }

    public OnVehicleSpawn(vehicleid)
    {
        return 1;
    }

    public OnVehicleDeath(vehicleid, killerid)
    {
        return 1;
    }
    public OnPlayerCommandText(playerid, cmdtext[])
    {


        if (strcmp("/cgraffity", cmdtext, true, 10) == 0)
        {
        ShowPlayerDialog(playerid, 1998, DIALOG_STYLE_MSGBOX, "Graffity System", "Sigur vrei sa creezi un tatuaj?", "Da", "Nu");
        return 1;
        }
        if (strcmp("/cremove", cmdtext, true, 10) == 0)
        {
        DestroyObject(graffity);
        SendClientMessage(playerid,-1,"Ai sters tatuaju.");
        return 1;
        }
        if(strcmp("/graffity", cmdtext, true, 10) == 0)
        {
         format(text, 50, "{30a030}[Graffity] {FFFFFF}Tu ai facut pana acuma {30a030}[ %d ] {FFFFFF}tatuaje", GraffityDone[playerid]);
         SendClientMessage(playerid, -1, text);
          return 1;
              }
        return 0;
    }
    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
        if(dialogid == 1998)
        {
            if(response)
            {
                  SendClientMessage(playerid,-1,"Aranjeaza cum vrei sa fie pozitionat tatuaju.");
                   new Float:X, Float:Y, Float:Z, Float:A;
                GetPlayerFacingAngle(playerid, A);
                 GetPlayerPos(playerid, X, Y, Z);
                graffity = CreateObject(19482,X,Y,Z+0.5,0.0,0.0,0.0,0.0);
                SetObjectMaterialText(graffity,"Tatuaj nou",0,OBJECT_MATERIAL_SIZE_256x256,"Comic Sans MS",24,1,0xAA3333AA,0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
                EditObject(playerid,graffity);
                graf[playerid] = 1;
                GraffityDone[playerid]++;
            }
          }
       if(dialogid == 1996)
       {
            if(response)
            {
                if(listitem == 0)
                {
                    if(GrafFont[playerid] == 1)
                    {
                    SetObjectMaterialText(graffity, GrafText[playerid],0,OBJECT_MATERIAL_SIZE_256x256,"Arial",24,1,-256,0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
                    }
                    if(GrafFont1[playerid] == 1)
                    {
                    SetObjectMaterialText(graffity, GrafText[playerid],0,OBJECT_MATERIAL_SIZE_256x256,"Comic Sans MS",24,1,-256,0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
                    }
                    if(GrafFont2[playerid] == 1)
                    {
                    SetObjectMaterialText(graffity, GrafText[playerid],0,OBJECT_MATERIAL_SIZE_256x256,"Italic",24,1,-256,0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
                    }
                    if(GrafFont3[playerid] == 1)
                    {
                    SetObjectMaterialText(graffity, GrafText[playerid],0,OBJECT_MATERIAL_SIZE_256x256,"Courier",24,1,-256,0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
                    }
                }
                if(listitem == 1)
                {
                    if(GrafFont[playerid] == 1)
                    {
                    SetObjectMaterialText(graffity, GrafText[playerid],0,OBJECT_MATERIAL_SIZE_256x256,"Arial",24,1,-16468988,0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
                    }
                    if(GrafFont1[playerid] == 1)
                    {
                    SetObjectMaterialText(graffity, GrafText[playerid],0,OBJECT_MATERIAL_SIZE_256x256,"Comic Sans MS",24,1,-16468988,0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
                    }
                    if(GrafFont2[playerid] == 1)
                    {
                    SetObjectMaterialText(graffity, GrafText[playerid],0,OBJECT_MATERIAL_SIZE_256x256,"Italic",24,1,-16468988,0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
                    }
                    if(GrafFont3[playerid] == 1)
                    {
                    SetObjectMaterialText(graffity, GrafText[playerid],0,OBJECT_MATERIAL_SIZE_256x256,"Courier",24,1,-16468988,0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
                    }
                }
                if(listitem == 2)
                {
                    if(GrafFont[playerid] == 1)
                    {
                    SetObjectMaterialText(graffity, GrafText[playerid],0,OBJECT_MATERIAL_SIZE_256x256,"Arial",24,1,-16730675,0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
                    }
                    if(GrafFont1[playerid] == 1)
                    {
                    SetObjectMaterialText(graffity, GrafText[playerid],0,OBJECT_MATERIAL_SIZE_256x256,"Comic Sans MS",24,1,-16730675,0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
                    }
                    if(GrafFont2[playerid] == 1)
                    {
                    SetObjectMaterialText(graffity, GrafText[playerid],0,OBJECT_MATERIAL_SIZE_256x256,"Italic",24,1,-16730675,0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
                    }
                    if(GrafFont3[playerid] == 1)
                    {
                    SetObjectMaterialText(graffity, GrafText[playerid],0,OBJECT_MATERIAL_SIZE_256x256,"Courier",24,1,-16730675,0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
                    }
                }
            }
        }
       if(dialogid == 1995)
       {
            if(response)
            {
                if(listitem == 0)
                {
                    SetObjectMaterialText(graffity, GrafText[playerid],0,OBJECT_MATERIAL_SIZE_256x256,"Arial",24,1,-256,0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
                       ShowPlayerDialog(playerid, 1996, DIALOG_STYLE_LIST, "Color Graffity", "Yellow\nGreen\nSky-Blue", "Select", "Close");
                       GrafFont[playerid] = 1;
                }
                if(listitem == 1)
                {
                    SetObjectMaterialText(graffity, GrafText1[playerid],0,OBJECT_MATERIAL_SIZE_256x256,"Comic Sans MS",24,1,-16468988,0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
                       ShowPlayerDialog(playerid, 1996, DIALOG_STYLE_LIST, "Color Graffity", "Yellow\nGreen\nSky-Blue", "Select", "Close");
                       GrafFont1[playerid] = 1;
                }
                if(listitem == 2)
                {
                    SetObjectMaterialText(graffity, GrafText2[playerid],0,OBJECT_MATERIAL_SIZE_256x256,"Italic",24,1,-16730675,0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
                     ShowPlayerDialog(playerid, 1996, DIALOG_STYLE_LIST, "Color Graffity", "Yellow\nGreen\nSky-Blue", "Select", "Close");
                     GrafFont2[playerid] = 1;
                }
                if(listitem == 3)
                {
                    SetObjectMaterialText(graffity, GrafText2[playerid],0,OBJECT_MATERIAL_SIZE_256x256,"Courier",24,1,-16730675,0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
                     ShowPlayerDialog(playerid, 1996, DIALOG_STYLE_LIST, "Color Graffity", "Yellow\nGreen\nSky-Blue", "Select", "Close");
                     GrafFont3[playerid] = 1;
                }
            }
        }
        if(dialogid == 1997)
        {
            if(response)
            {
                if(!strlen(inputtext))
                {
                    SendClientMessage(playerid,-1,"ERROR: Not write in the box text. !");
                    ShowPlayerDialog(playerid, 1997, DIALOG_STYLE_INPUT, "Graffity System", "Scrie in aceasta casuta cu ce nume vrei sa fie tatuaju.", "Ok", "");
                    return 1;
                }
                new Float:X, Float:Y, Float:Z, Float:A;
                GetPlayerFacingAngle(playerid, A);
                GetPlayerPos(playerid, X, Y, Z);
                SetObjectMaterialText(graffity, inputtext,0,OBJECT_MATERIAL_SIZE_256x256,"Comic Sans MS",24,1,0xAA3333AA,0,OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
                format(GrafText[playerid], MAX_GRAFTEXT, inputtext);
                format(GrafText1[playerid], MAX_GRAFTEXT, inputtext);
                format(GrafText2[playerid], MAX_GRAFTEXT, inputtext);
                //strcat(GrafText[playerid], inputtext, MAX_GRAFTEXT);
                //strcat(GrafText1[playerid], inputtext, MAX_GRAFTEXT);
                //strcat(GrafText2[playerid], inputtext, MAX_GRAFTEXT);
                ShowPlayerDialog(playerid, 1995, DIALOG_STYLE_LIST, "Font Graffity", "Arial\nComic Sans MS\nItalic\nCourier", "Select", "Close");
                graf[playerid] = 0;
            }
        }
        return 1;
    }

    public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
    {
        new Float:oldX, Float:oldY, Float:oldZ,
            Float:oldRotX, Float:oldRotY, Float:oldRotZ;
        GetObjectPos(graffity, oldX, oldY, oldZ);
        GetObjectRot(graffity, oldRotX, oldRotY, oldRotZ);
        if(!playerobject)
        {
            if(!IsValidObject(graffity)) return;
            MoveObject(graffity, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ);
        }
            if(response == EDIT_RESPONSE_FINAL)
            {
            SendClientMessage(playerid,-1,"Acum foloseste acest spray pentru a finaliza tatuaju !");
            GivePlayerWeapon(playerid, 41, 5000);
           
            }
    }

    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
        if(newkeys & KEY_FIRE && GetPlayerWeapon(playerid) == 41)
        {
           if(graf[playerid] == 1)
           {
            SetTimerEx("Object", 5000, false, "i", playerid);
        }
       }
        return 1;
    }

    forward Object(playerid);

    public Object(playerid)
    {
       ShowPlayerDialog(playerid, 1997, DIALOG_STYLE_INPUT, "Graffity System", "Scrie in aceasta casuta cu ce nume vrei sa fie tatuaju.", "Ok", "");
        return 1;
    }


Опубликовано 09 December 2013