Graffiti Problem
#1

Код:
#include <a_samp>
#include <streamer>

enum graff {
        pgText[30],
        pgColor,
        pgBold,
        pgSize,
        pgSpraying,
        bool:pgCommand
}
new pGraff[MAX_PLAYERS][graff];

#define MAX_GRAFFS 100
#define DIALOG_SPRAY 8000

enum GraffSystem
{
        Van,
        gSQLID,
        Object,
        gText[30],
        Float:X,
        Float:Y,
        Float:Z,
        Float:RotX,
        Float:RotY,
        Float:RotZ,
        gFont[30],
        gColor,
        gSize,
        gOwner
};
new Graff[MAX_GRAFFS][GraffSystem];

public OnFilterScriptExit()
{
        for(new i = 0; i < MAX_GRAFFS; i++)
        {
                if(Graff[i][Van] == 0) continue;
                DestroyDynamicObject(Graff[i][Object]);
                printf("[GRAFFITI]ID#%d tцrцlve", i);
                for(new a; GraffSystem:a < GraffSystem; a++) Graff[i][GraffSystem:a] = -1;
        }
        return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
        if(!strcmp(cmdtext, "/asda4w66rtfgh", true))
        {
                SelectObject(playerid);
                return 1;
        }
        if(!strcmp(cmdtext, "/spray", true))
        {
        if(!IsPlayerConnected(playerid)) return 1;
                if(!pGraff[playerid][pgCommand])
                {
                        pGraff[playerid][pgCommand] = true;
                        SendClientMessage(playerid, -1, "Graffiti mуd bekapcsolva! 5 mбsodpercig fъjnod kell a falat graffiti lerakбsбhoz.");
                        GivePlayerWeapon(playerid, 41, 50000);
                }
                else
                {
                        pGraff[playerid][pgCommand] = false;
                        SendClientMessage(playerid, -1, "Graffiti mуd kikapcsolva!");
                }
                return 1;
        }
        return 0;
}

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

forward SpreFujas(playerid);
public SpreFujas(playerid)
{
        new keys, ud, lr;
    GetPlayerKeys(playerid, keys, ud, lr);

        if(keys == KEY_FIRE && GetPlayerWeapon(playerid) == 41)
        {
                SendClientMessage(playerid, 0xFF6347AA, "Lehetoleg olyan helyre rakd, ahol nem gбtol senkit a mozgбsban, mivel ez szinte lбthatatlan objekt!");
                ShowPlayerDialog(playerid, DIALOG_SPRAY, DIALOG_STYLE_INPUT, "{FFFFFF}Graffiti rendszer|{9ACD32}Szцveg", "Нrd be a felнrni kнvбnt ьzenetet:", "Rendben", "Bezбr");
                pGraff[playerid][pgCommand] = false;
        }
        return 1;
}

public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)
{
        if(response == EDIT_RESPONSE_UPDATE)
        {
                if(pGraff[playerid][pgSpraying] > 0)
            {
                        MoveDynamicObject(objectid, x, y, z, 10.0, rx, ry, rz);
                }
        }
        if(response == EDIT_RESPONSE_FINAL || response == EDIT_RESPONSE_CANCEL)
        {
                if(pGraff[playerid][pgSpraying] > 0)
            {
                        SetDynamicObjectPos(objectid, x, y, z);
                        SetDynamicObjectRot(objectid, rx, ry, rz);
                new g = pGraff[playerid][pgSpraying];
                Graff[g][X] = x;
                Graff[g][Y] = y;
                Graff[g][Z] = z;
                Graff[g][RotX] = rx;
                Graff[g][RotY] = ry;
                Graff[g][RotZ] = rz;
                pGraff[playerid][pgSpraying] = 0;
            }
        }
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        switch(dialogid)
        {
            case DIALOG_SPRAY:
            {
                if(response)
                {
                        if(strlen(inputtext) > 30)
                        {
                        ShowPlayerDialog(playerid, DIALOG_SPRAY, DIALOG_STYLE_INPUT, "{FFFFFF}Graffiti rendszer|{9ACD32}Szцveg", "A szцveg tъl hosszъ\nНrd be a felнrni kнvбnt ьzenetet:", "Rendben", "Bezбr");//WRITE THE WORD
                        return 1;
                        }
                        		strmid(pGraff[playerid][pgText], inputtext, 0, strlen(inputtext), 255);
                                ShowPlayerDialog(playerid, DIALOG_SPRAY+1, DIALOG_STYLE_LIST, "{FFFFFF}Graffiti rendszer|{9ACD32}Betuszнn", "Piros\nKйk\nFehйr\nZцld\nRуzsaszнn\nSбrga\nFekete", "Rendben", "Bezбr");//THI ISN't show :(
                }
            }
            case DIALOG_SPRAY+1:
            {
                if(response)
                {
                        pGraff[playerid][pgColor] = listitem;
                        ShowPlayerDialog(playerid, DIALOG_SPRAY+2, DIALOG_STYLE_LIST, "{FFFFFF}Graffiti rendszer|{9ACD32}Betustнlus", "Alap\nFйlkцvйr", "Rendben", "Bezбr");
                }
            }
            case DIALOG_SPRAY+2:
            {
                if(response)
                {
                                pGraff[playerid][pgBold] = listitem;
                                ShowPlayerDialog(playerid, DIALOG_SPRAY+3, DIALOG_STYLE_INPUT, "{FFFFFF}Graffiti rendszer|{9ACD32}Betumйret", "Нrd be a betumйretet:", "Rendben", "Bezбr");
                }
            }
            case DIALOG_SPRAY+3:
            {
                if(response)
                {
                        pGraff[playerid][pgSize] = strval(inputtext);
                        ShowPlayerDialog(playerid, DIALOG_SPRAY+4, DIALOG_STYLE_LIST, "{FFFFFF}Graffiti rendszer|{9ACD32}Betutнpus", "Arial\nComic Sans MS\nItalic\nCourier", "Rendben", "Bezбr");
                }
            }
            case DIALOG_SPRAY+4:
            {
                if(response)
                {
                                new Float:gpx,Float:gpy,Float:gpz, szin[16], betu[16];
                                GetPlayerPos(playerid, gpx, gpy, gpz);
                                SetPlayerPos(playerid, gpx, gpy, gpz+1.0);
                        switch(pGraff[playerid][pgColor])
                                {
                                case 0:
                                {
                                                format(szin, sizeof(szin), "0xFFFF0000");
                                }
                                case 1:
                                {
                                                format(szin, sizeof(szin), "0xFF0088FF");
                                }
                                case 2:
                                {
                                                format(szin, sizeof(szin), "0xFFFFFFFF");
                                }
                                case 3:
                                {
                                                format(szin, sizeof(szin), "0xFF09AD00");
                                }
                                case 4:
                                {
                                                format(szin, sizeof(szin), "0xFFC200DB");
                                }
                                case 5:
                                {
                                                format(szin, sizeof(szin), "0xFFFFFB00");
                                }
                                case 6:
                                {
                                                format(szin, sizeof(szin), "0xFF000000");
                                }
                                default:
                                {
                                                format(szin, sizeof(szin), "0xFF000000");
                                }
                        }
                        switch(listitem)
                                {
                                case 0:
                                {
                                                betu = "Arial";
                                }
                                case 1:
                                {
                                                betu = "Comic Sans MS";
                                }
                                case 2:
                                {
                                                betu = "Italic";
                                }
                                case 3:
                                {
                                                betu = "Courier";
                                }
                                default:
                                {
                                                betu = "Arial";
                                }
                        }

                                for(new i = 1; i < MAX_GRAFFS; i++)
                                {
                                        if(Graff[i][Van] == 0)
                                        {
                                                Graff[i][gOwner] = playerid;
                                                new Float:angle;
                                                Graff[i][Van] = 1;
                                                GetPlayerPos(playerid, Graff[i][X], Graff[i][Y], Graff[i][Z]);
                                                GetPlayerFacingAngle(playerid, angle);

                                                Graff[i][Object] = CreateDynamicObject(19353, Graff[i][X], Graff[i][Y], Graff[i][Z], 0.0, 0.0, angle-90.0);
                                                SetDynamicObjectMaterial(Graff[i][Object], 0, 0, "none", "none", 0);
                                                SetDynamicObjectMaterialText(Graff[i][Object], 0, pGraff[playerid][pgText], OBJECT_MATERIAL_SIZE_256x128, betu, pGraff[playerid][pgSize], pGraff[playerid][pgBold], HexToInt(szin), 0x00000000, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);

                                                strmid(Graff[i][gText], pGraff[playerid][pgText], 0, strlen(pGraff[playerid][pgText]), 255);
                                                strmid(Graff[i][gFont], betu, 0, strlen(betu), 255);
                                                Graff[i][gSize] = pGraff[playerid][pgSize];
                                                Graff[i][gColor] = pGraff[playerid][pgColor];

                                                pGraff[playerid][pgSpraying] = i;
                                                Streamer_UpdateEx(playerid, Graff[i][X], Graff[i][Y], Graff[i][Z], GetPlayerVirtualWorld(playerid),GetPlayerInterior(playerid));
                                                EditDynamicObject(playerid, Graff[i][Object]);
                                                SetPlayerPos(playerid, Graff[i][X]+2 , Graff[i][Y], Graff[i][Z]);
                                                return 1;
                                        }
                                }
                }
                }
        }
        return 1;
}

HexToInt(string[])
{
        if (string[0]==0) return 0;
        new i;
        new cur=1;
        new res=0;
        for (i=strlen(string);i>0;i--) {
                if (string[i-1]<58) res=res+cur*(string[i-1]-48); else res=res+cur*(string[i-1]-65+10);
                cur=cur*16;
        }
        return res;
}
What's the problem?
Don't show DIALOG_SPRAY+1
Reply
#2

Have you tried defining the dialog ids rather than +1 to an existing one?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)