Jump to content
  • 0

pomoc Bot text (nejdou jina ID)


GT222

Dotaz

Ahoj , tak jsem se vrátil z dovolené a vrhnul jsem se na to , a hned nastal problém , mam udělané že když přijde hráč k actoru napíše mu to text funguje to bez problému ale je tu jedna věc. Text se ukazuje jen pro ID 0 a jiným ID jako je ID 1 atd.. tak se prostě nechce ukázat , potrřeboval bych pomoct díky ..

 

-není to moje je to z forka jen jsem si to upravil a testuju to na tom ..

new newbots[11];
new Float:botspos[11][4] =
{
    {-2044.6414,-73.0285,35.1654,261.9243},
    {-2044.7527,-71.2850,35.1654,270.8051},
    {-2044.5800,-68.8320,35.1719,265.5346},
    {-2044.1322,-66.0574,35.1719,260.2641},
    {-2043.9573,-63.3140,35.3138,265.8560},
    {-2048.6926,-63.5179,35.3138,269.2753},
    {-2048.7451,-65.9503,35.1719,263.4617},
    {-2048.8828,-70.3972,35.1654,269.0536},
    {-2052.4180,-69.8755,35.1719,268.9924},
    {-2056.7944,-72.4872,35.1719,263.8214},
    {-2056.4675,-75.6744,35.3138,270.4995}
};

public OnGameModeInit()
{
    for(new i; i < sizeof(botspos); i++) newbots = CreateActor(205, botspos[0],botspos[1], botspos[2], botspos[3]);
    SetTimer("Texts",300,1);
    return 1;
}

forward Texts(playerid);
public Texts(playerid)
{
for(new i=0; i < MAX_PLAYERS; i++){
if(!PED_IsConnected(newbots)) continue;
if(!PED_IsDead(newbots)){
new Float:pos[3];
if(PED_IsConnected(newbots))
{
if(PED_GetFollowingPlayer(i) != INVALID_PLAYER_ID)
{
GetPlayerPos(PED_GetFollowingPlayer(i), pos[0], pos[1], pos[2]);
if(PED_IsInRangeOfPoint(newbots, 1.0, pos[0], pos[1], pos[2]))
{
SendClientMessage(playerid, 0xEFEFF7AA, "Rick: Odejdi pryč ted nemam čas!!");
}continue;
}
}}}
return 1;
}

využíva include: PEDs Include

 

Zkoušel jsem i for(new i=0; i < MAX_PLAYERS; i++){ ale to bylo furt to samé.

Edited by GT222
Link to comment
Share on other sites

7 odpovědí na tuto otázku

Recommended Posts

  • 0

z timeru neposíláš žádná data

 

blbost - public Texts(playerid)

...

tím pádem proměnná playerid je 0

 

SendClientMessage(playerid,..);

Link to comment
Share on other sites

  • 0

já si to cely předělám , jen mi de o to aby to šlo všem hráčům potřebuji radu už několik hodin jsem se snažil na to přijít ale bez úspěchu :( jen potřebuji vědět kde mam chybu že to de jen pro ID 0

Link to comment
Share on other sites

  • 0
SendClientMessage(playerid, 0xEFEFF7AA, "Rick: Odejdi pryč ted nemam čas!!");

zmen na

SendClientMessage(i, 0xEFEFF7AA, "Rick: Odejdi pryč ted nemam čas!!");

a v tom public to playerid smaz.

 

Tohle je prave dusledek toho kdyz se tvrdou silou umlcuji errory, ale nepremysli se nad tim ze diky errorum ti to hlasi logicky chyby v kodu.

Link to comment
Share on other sites

  • 0

Promiňte vratil jsem se z dovolené , tak jsem to tedy zkusil SendClientMessage(i, 0xEFEFF7AA, "Rick: Odejdi pryč ted nemam čas!!"); a smazal playerid u publicu a forwardu , teď mi to píše text jen u 1 actoru u toho prvního u ostatních ne , ale nejhorší je že to zase ukazuje jen ID 0 jiným ID opět nic :(, jak by to ještě šlo udělat prosím :( určitě je nějaký řešení ale nejspíš to nebude jednoduché :(

Edited by GT222
Link to comment
Share on other sites

  • 0


public Texts()
{
    for(new i;i<sizeof(botspos);i++)
    {
        if(PED_IsConnected(newbots[i]) && !PED_IsDead(newbots[i]) && PED_GetFollowingPlayer(i) != INVALID_PLAYER_ID)
        {
            for(new p,j=GetPlayerPoolSize();p<=j;p++)
            {
                if(IsPlayerConnected(p))
                {
                    new Float:pos[3];
                    GetPlayerPos(p,pos[0],pos[1],pos[2]);//PED_GetFollowingPlayer(i) nevim co si s tim zamyslel... kazdopadne jsem to udelal tak ze staci byt blizko actora
                    if(PED_IsInRangeOfPoint(newbots[i],1.0,pos[0],pos[1],pos[2])) return SendClientMessage(p,0xEFEFF7AA,"Rick: Odejdi pryč ted nemam čas!!");
                }
            }
        }
    }
    return 1;
}

 

Edited by ATomas
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...