Pomoc u vezi OnPlayerGiveDamageActor


Započeo mattazz, Septembar 26, 2020, 13:09:15 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Pokusavam da napravim kada upucam actora da mi iskoci dialog za dm arenu,ali nikako nece,ako moze neko da pomogne bilo bi super

KOD IZ SKRIPTER:
new Actor_DM;
Actor_DM = CreateDynamicActor(230, 1728.7434,-1655.4818,20.2484,93.0006);

public OnPlayerGiveDamageActor(playerid, damaged_actorid, Float:amount, weaponid, bodypart)
{
    if(IsValidActor(Actor_DM))
    {
    	new string[1560];
		format(string, sizeof(string), "Lokacija:\tIgraca:\n"PPLAVA"[1]: "BELA"DeathMatch - Ghost Town\t[%d]\n"PPLAVA"[2]: "BELA"DeathMatch - Interior 1\t[%d]\n"PPLAVA"[3]: "BELA"DeathMatch - Police Dept.\t[%d]\n"PPLAVA"[4]: "BELA"Spawn\tn/a",
  				IgracaUDMZoni_GhostTown, IgracaUDMZoni_Interior1, IgracaUDMZoni_PoliceDept);
		SPD(playerid, DIALOG_TELEPORT, DSTH, D_NASLOV, string, D_POTVRDI, D_ZATVORI);
    }
    return 1;
}
Poslednja Izmena: Septembar 27, 2020, 16:45:10 POSLE PODNE od V01D

Zato što si napravio 2 greške:

1. Praviš dinamičnog aktora, a koristiš callback za obične:
zamjeni
public OnPlayerGiveDamageActor(playerid, damaged_actorid, Float:amount, weaponid, bodypart)

sa
public OnPlayerGiveDamageDynamicActor(playerid, actorid, Float:amount, weaponid, bodypart)


2. Nije ti dobra provjera, moraš provjeriti actor id, ne da li je validan, odnosno u tom slučaju, bilo kojeg dinamičkog aktora da neki igrač opuca, ukoliko je DM aktor validan (bez obzira što njega nije upucao), tebi će se dialog pojaviti.
zamjeni
if(IsValidActor(Actor_DM))

sa
if(actorid == Actor_DM)


Mozes i ovako nesto, koristeci obicne :

new NekiActor;

public OnGameModeInit() {

	NekiActor = CreateActor(skinID, X, Y, Z, Rot);
	SetActorInvulnerable(NekiActor, 0);
	return 1;
}

public OnPlayerGiveDamageActor(playerid, damaged_actorid, Float:amount, weaponid, bodypart) {

	if(damaged_actorid == NekiActor) {
		
		SendClientMesssage(playerid, -1, "Actor Upucan!");
		return 1;
	}
	return 1;
}


Mozes i dinamicke, potpuno je na tebi, u tom slucaju samo koristis :

OnPlayerGiveDamageDynamicActor(playerid, STREAMER_TAG_ACTOR actorid, Float:amount, weaponid, bodypart)

Umesto ovoga :
OnPlayerGiveDamageActor(playerid, damaged_actorid, Float:amount, weaponid, bodypart)

Mislim da je Slade sve objasnio, ne treba da se ponavljaš.
You'll be always in my heart, the end and thanks for amazing times. #WeAreLords

Ja sam stavio ovako sve,ali opet kad ga upucam ne izadje mi taj dialog,nzm do cega je problem

KOD IZ SKRIPTE:

new Actor_DM;

ovo je u ongamemodeinit

Actor_DM = CreateActor(230, 1728.7434,-1655.4818,20.2484,93.0006);
SetActorInvulnerable(Actor_DM, 0);

public OnPlayerGiveDamageActor(playerid, damaged_actorid, Float:amount, weaponid, bodypart)
{
    if(damaged_actorid == Actor_DM)
    {
    	new string[1560];
		format(string, sizeof(string), "Lokacija:\tIgraca:\n"PPLAVA"[1]: "BELA"DeathMatch - Ghost Town\t[%d]\n"PPLAVA"[2]: "BELA"DeathMatch - Interior 1\t[%d]\n"PPLAVA"[3]: "BELA"DeathMatch - Police Dept.\t[%d]\n"PPLAVA"[4]: "BELA"Spawn\tn/a",
  				IgracaUDMZoni_GhostTown, IgracaUDMZoni_Interior1, IgracaUDMZoni_PoliceDept);
		SPD(playerid, DIALOG_TELEPORT, DSTH, D_NASLOV, string, D_POTVRDI, D_ZATVORI);
		return 1;
    }
    return 1;
}

Pokušao sam i praznu sktiptu VO1D-ov kod,ali opet je isto ja pucam actora ali ne izlazi dialog


Evo ovako sam stavio

new NekiAktor; 

ovo je u OnGameModeInit 


NekiAktor = CreateActor(294, 1728.7434,-1655.4818,20.2484,93.0006); 

SetActorInvulnerable(NekiAktor, 0); 

 

public OnPlayerGiveDamageActor(playerid, damaged_actorid, Float:amount, weaponid, bodypart) 

{ 

if(damaged_actorid == NekiAktor) 

{ 
                SCM(playerid, -1, "VO1D pomaze da fixam");
		return 1; 

} 

return 1; 

}

Zašto jednostavno nisi uradio kako sam ti ja napisao?

Pa i kad sam uradio ka sto si mi ti rekao nije opet radilo

Pošalji hajde kako si uradio sa mojim kodom,kako je on izgledao kompletan?

Jesi ti retardiran lik ti je napisao da si kreirao dynamic aktora i koristis callback za obicne i ti kazes da su uradio kao sto ti je poslao ?


@Slade evo sad cu da stavim kao ti,pa cu ds vidim,ako ne radi saljem kod  :)

Evo sad sam radio kao sto si mi ti reko,sad mi reci sta treba radim

Actor_DM = CreateDynamicActor(230, 1728.7434,-1655.4818,20.2484,93.0006);

public OnPlayerGiveDamageDynamicActor(playerid, actorid, Float:amount, weaponid, bodypart)
{
    if(actorid == Actor_DM)
    {
		SCM(playerid, -1, "Ne pucaj seljaku boli me");
		return 1;
    }
    return 1;
}