mysql aktora nece

Započeo Skorpija_026
23. Mar. 2020.
644
pregleda
5
postova
David||BM
5
Made Man
🔥3
23. Mar. 2020.
Problem(error/warning): Nece da mi lepo cuva aktora nece ni da ga kreira kako treba
Dio skripte:
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define AKTOR_FILE          "Aktori/%d.ini"
#define MAX_AKTORI          300

enum AKTOR_INFO {

Float:ActorPos,
    aktorskin,
    aktorime[ 40 ],
    aktoranimacija,
    aktorid,
}
new AktorInfo[ MAX_AKTORI ][ AKTOR_INFO ], Text3D:AktorLabel[ sizeof(AktorInfo) ];
//------------------------------------------------------------------------------
sacuvajactora(id)
{
new query;
format(query, sizeof(query), "Actor_Ime='%s',Actor_X='%f',Actor_Y='%f',Actor_Z='%f',Actor_A='%i',Actor_Skin='%i',Actor_Animacija='%i'",
AktorInfo[ id ][ aktorid ],
    AktorInfo[ id ][ aktorime ],
    AktorInfo[ id ][ ActorPos ][ 0 ],
    AktorInfo[ id ][ ActorPos ][ 1 ],
    AktorInfo[ id ][ ActorPos ][ 2 ],
    AktorInfo[ id ][ ActorPos ][ 3 ],
    AktorInfo[ id ][ aktorskin ],
    AktorInfo[ id ][ aktoranimacija ]);

    format(query, sizeof(query), "UPDATE aktori SET %s WHERE Actor_Id='%i'", query, AktorInfo[ id ][ aktorid ]);
mysql_function_query(Zylantmajskvel, query, false, "", "");
return 1;
}
//------------------------------------------------------------------------------
GetAktorID()
{
for(new i=0; i {
    if(AktorInfo==0)return i;
}
return 0;
}
//------------------------------------------------------------------------------
forward AktoraNapravi(id);
public AktoraNapravi(id)
{
AktorInfo[ id ][ aktorid ] = cache_insert_id();
}
forward UcitajAktore();
public UcitajAktore()
{
    new num_aktorim,num_aktorima;
cache_get_data(num_aktorima,num_aktorim,Zylantmajskvel);
if(!num_aktorima)return 1;
for(new i=0; i {
new id = GetAktorID();
    cache_get_field_content( i, "Actor_Ime", AktorInfo[ id ][ aktorime ], Zylantmajskvel, 45 );
    AktorInfo[ id ][ ActorPos ][ 0 ] = cache_get_field_content_float(i, "Actor_X", Zylantmajskvel);
    AktorInfo[ id ][ ActorPos ][ 1 ] = cache_get_field_content_float(i, "Actor_Y", Zylantmajskvel);
    AktorInfo[ id ][ ActorPos ][ 2 ] = cache_get_field_content_float(i, "Actor_Z", Zylantmajskvel);
    AktorInfo[ id ][ ActorPos ][ 3 ] = cache_get_field_content_float(i, "Actor_A", Zylantmajskvel);
    AktorInfo[ id ][ aktorid ] = cache_get_field_content_int(i, "Actor_Id", Zylantmajskvel);
    AktorInfo[ id ][ aktorskin ] = cache_get_field_content_int(i, "Actor_Skin", Zylantmajskvel);
    AktorInfo[ id ][ aktoranimacija ] = cache_get_field_content_int(i, "Actor_Animacija", Zylantmajskvel);
    KreirajAktora( id );
    AktorLabelPickup( id );
}
return 1;
}
//------------------------------------------------------------------------------
stock KreirajAktora(actorem)
{
new str, aktornick[ 40 ];
SetPlayerPos(actorem, AktorInfo[ actorem ][ ActorPos ][ 0 ]+2, AktorInfo[ actorem ][ ActorPos ][ 1 ]+2, AktorInfo[ actorem ][ ActorPos ][ 2 ]);
AktorInfo[ actorem ][ aktorid ] = CreateActor(AktorInfo[ actorem ][ aktorskin ], AktorInfo[ actorem ][ ActorPos ][ 0 ], AktorInfo[ actorem ][ ActorPos ][ 2 ], AktorInfo[ actorem ][ ActorPos ][ 2 ], AktorInfo[ actorem ][ ActorPos ][ 3 ]);
ApplyActorAnimation(AktorInfo[ actorem ][ aktorid ], "DEALER","DEALER_IDLE", 4.0,1, 1, 1, 1, 0);
format(str, sizeof(str), ""SRWBOJA"%s\n"C_BELA"(( ID: %d ))", aktornick, actorem);
AktorLabel[ actorem ] = Create3DTextLabel(str, -1, AktorInfo[ actorem ][ ActorPos ][ 0 ], AktorInfo[ actorem ][ ActorPos ][ 2 ], AktorInfo[ actorem ][ ActorPos ][ 2 ]+1.0, 10.0, 0);
  sacuvajactora(actorem);
return 1;
}
//------------------------------------------------------------------------------
stock AktorLabelPickup( actorem )
{
    new str, aktornick[ 40 ];
SetPlayerPos(actorem, AktorInfo[ actorem ][ ActorPos ][ 0 ]+2, AktorInfo[ actorem ][ ActorPos ][ 1 ]+2, AktorInfo[ actorem ][ ActorPos ][ 2 ]);
AktorInfo[ actorem ][ aktorid ] = CreateActor(AktorInfo[ actorem ][ aktorskin ], AktorInfo[ actorem ][ ActorPos ][ 0 ], AktorInfo[ actorem ][ ActorPos ][ 2 ], AktorInfo[ actorem ][ ActorPos ][ 2 ], AktorInfo[ actorem ][ ActorPos ][ 3 ]);
ApplyActorAnimation(AktorInfo[ actorem ][ aktorid ], "DEALER","DEALER_IDLE", 4.0,1, 1, 1, 1, 0);
format(str, sizeof(str), ""SRWBOJA"%s\n"C_BELA"(( ID: %d ))", aktornick, actorem);
AktorLabel[ actorem ] = Create3DTextLabel(str, -1, AktorInfo[ actorem ][ ActorPos ][ 0 ], AktorInfo[ actorem ][ ActorPos ][ 2 ], AktorInfo[ actorem ][ ActorPos ][ 2 ]+1.0, 10.0, 0);
return 1;
}

//------------------------------------------------------------------------------

Dialog ,tjst komanda
fDialog(16512)
{
new skinid;
if(sscanf(inputtext, "d", skinid)) return SPD(playerid, 16512, DIALOG_STYLE_INPUT, ""C_BELA"Kreiranje aktora", ""C_BELA"Unesite ID skina aktora.\nPrimer: "C_BELA"294", "U redu", "Izlaz");
if(skinid > 311) return SPD(playerid, 16512, DIALOG_STYLE_INPUT, ""SRWBOJA"Kreiranje aktora", ""C_BELA"*Pogresili ste id aktora, minimalan je 0 a maksimalan 311\n"C_BELA"Unesite ID skina aktora.\nPrimer: "C_BELA"294", "U redu", "Izlaz");
new aktoric = GetAktorID();
AktorInfo[ aktoric ][ aktorskin ] = skinid;
AktorInfo;
new Float:PozX, Float:PozY, Float:PozZ;
    //GetPlayerPos( playerid, PozX, PozY, PozZ );
AktorInfo[ aktoric ][ ActorPos ][ 0 ] = PozX;
AktorInfo[ aktoric ][ ActorPos ][ 1 ] = PozY;
    AktorInfo[ aktoric ][ ActorPos ][ 2 ] = PozZ;
ShowPlayerDialog(playerid, 16513, DIALOG_STYLE_INPUT, ""C_BELA"Kreiranje aktora", ""C_BELA"Unesite ime aktora\nPrimer: "C_BELA"(( MAFIA BOSS ))", "U redu", "Izlaz");
return 1;
}
fDialog(16513)
{
new aktornick[ 40 ];
new aktoric = GetAktorID();
    if(sscanf(inputtext, "s", aktornick)) return ShowPlayerDialog(playerid, 16513, DIALOG_STYLE_INPUT, ""C_BELA"Kreiranje aktora", ""C_BELA"Unesite ime aktora\nPrimer: "C_BELA"(( MAFIA BOSS ))", "U redu", "Izlaz");
  AktorInfo[ aktoric ][ aktorime ] = aktornick;
    //GetPlayerPos( playerid, PozX, PozY, PozZ );
new queryaktors;
format(queryaktors, sizeof(queryaktors),
"INSERT INTO aktori ( Actor_Ime,Actor_X,Actor_Y,Actor_Z,Actor_A,Actor_Skin,Actor_Animacija) VALUES ('%i', '%s', '%f', '%f', '%f', '%f', '%f')",
AktorInfo,
AktorInfo[ ActorPos ][ 0 ],
  AktorInfo[ ActorPos ][ 1 ],
  AktorInfo[ ActorPos ][ 2 ],
AktorInfo,
AktorInfo);
mysql_function_query(Zylantmajskvel, queryaktors, true, "AktoraNapravi", "i", aktoric);
KreirajAktora(aktoric);
sacuvajactora( aktoric );
SendMessage( playerid, "Zavrsio si sa kreiranjem aktora." );
    return 1;
}


Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log): [ code ]nema[ /code ]
Slika/video ingame problema(obavezno ako je ingame problem): https://imgur.com/a/snBHCCj
Agency
5
Underboss
23. Mar. 2020.
Actor_A=`%i` ====> Actor_A=`%f`
TarikBrt
4
Shot Caller
23. Mar. 2020.
Prije svega podji da koristis mysql_format zbog %e tj. Escape stringa i sigurnosti protiv mysql injectiona. Takodjer i mysql_tquery umjesto function querya-a. Naravno moras pazit sa threadovima ukoliko nisi imao ranije iskustva jer se moze lako abuse-at i zbugat. GL.  😉
David||BM
5
Made Man
🔥3
23. Mar. 2020.
TarikBrt wrote on March 23, 2020, 5:20 pm:
Prije svega podji da koristis mysql_format zbog %e tj. Escape stringa i sigurnosti protiv mysql injectiona. Takodjer i mysql_tquery umjesto function querya-a. Naravno moras pazit sa threadovima ukoliko nisi imao ranije iskustva jer se moze lako abuse-at i zbugat. GL.  😉
znm za sve to ali razmisljam da predjem na mysql r41 posto je mnogo laksi od ovog a mrzi me da prebacujem jer stvarno mnogo ima
.agency wrote on March 23, 2020, 4:21 pm:
Actor_A=`%i` ====> Actor_A=`%f`
ma dzabe opet isto nece me spawna actora nigde
David||BM
5
Made Man
🔥3
24. Mar. 2020.
Fix Sam moze lock

Morate biti prijavljeni da biste odgovorili na ovu temu.

Prijava

© 2026 SmartShark. All rights reserved.

Powered by Momentum|v2026.3.001 Alpha