Jump to content
  • 0

pomoc Velikost CP


Deejva

Dotaz

Čau, kontroluji, zda je hráč ve vozidle. Pokud je, tak se zobrazí větší CP a pokud ne, zobrazí se menší CP. Vše funguje, až na velikost, u jednoho je velikost 4 a u druhého 2. Když jsem ve vozidle, zobrazí se velký CP, když vystoupím, tak se sice zobrazí, ale velký pořád. Když přiběhnu pěšky, tak je malý, když nastoupím do vozidla, tak je pořád malý..

Díky za rady

V cyklu

   if(IsPlayerInRangeOfPoint(i,10,HouseInfo[h][H_X],HouseInfo[h][H_Y],HouseInfo[h][H_Z]))
   {
       SetPlayerCheckpoint(i,HouseInfo[h][V_X],HouseInfo[h][V_Y],HouseInfo[h][V_Z],4);
   }
}else{
   if(IsPlayerInRangeOfPoint(i,10,HouseInfo[h][H_X],HouseInfo[h][H_Y],HouseInfo[h][H_Z]))
   {
       SetPlayerCheckpoint(i,HouseInfo[h][C_X],HouseInfo[h][C_Y],HouseInfo[h][C_Z],2);   } 

Prosím o rady :)

Edited by Deejva
Link to comment
Share on other sites

12 odpovědí na tuto otázku

Recommended Posts

  • 0
public CheckCheckpoint()
{
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
   DisablePlayerCheckpoint(i);
            for(new h; h < MAX_HOUSES; h++)
            {
if(strcmp(HouseInfo[h][Majitel],GetName(i), false) == 0)
{
if(IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
   if(IsPlayerInRangeOfPoint(i,10,HouseInfo[h][H_X],HouseInfo[h][H_Y],HouseInfo[h][H_Z]))
   {
       SetPlayerCheckpoint(i,HouseInfo[h][V_X],HouseInfo[h][V_Y],HouseInfo[h][V_Z],4);
   }
}else{
   if(IsPlayerInRangeOfPoint(i,10,HouseInfo[h][H_X],HouseInfo[h][H_Y],HouseInfo[h][H_Z]))
   {
       SetPlayerCheckpoint(i,HouseInfo[h][C_X],HouseInfo[h][C_Y],HouseInfo[h][C_Z],2);
   }
}
}
            }
}
}
}

Vím, není to moc optimalizované :d

Ale potřebuju projít vždy pokud má hráč dům, tak mu zobrazí CP, pokud je u něj, buď aby vstoupil nebo zaparkoval vozidlo. Zkoušel jsem před nastavování dávat Disable, dokonci i na začátek cyklu, ale nejde to..

Link to comment
Share on other sites

  • 0

Když to dam těsně před to,  tak to nefunguje

 

a co to zkusit takhle:

new check[MAX_PLAYERS] = false

public MultiTimer()
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInRangeOfPoint(i,10,HouseInfo[h][H_X],HouseInfo[h][H_Y],HouseInfo[h][H_Z]) && check[i] == false)
            {
                if(IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
                {
                    check[i] = true;
                       SetPlayerCheckpoint(i,HouseInfo[h][V_X],HouseInfo[h][V_Y],HouseInfo[h][V_Z],4);
                }
                else if(!IsPlayerInAnyVehicle(i) || GetPlayerState(i) != PLAYER_STATE_DRIVER)
                {
                    check[i] = true;
                    SetPlayerCheckpoint(i,HouseInfo[h][C_X],HouseInfo[h][C_Y],HouseInfo[h][C_Z],2);
                }
            }

            if(!IsPlayerInRangeOfPoint(i,10,HouseInfo[h][H_X],HouseInfo[h][H_Y],HouseInfo[h][H_Z]) && check[i] == true)
            {
                DisablePlayerCheckpoint();
                check[i] = false;
            }
        }
    }
}

public OnPlayerEnterVehicle(playerid,vehicleid)
{
    if(IsPlayerInRangeOfPoint(playerid,10,HouseInfo[h][H_X],HouseInfo[h][H_Y],HouseInfo[h][H_Z]) && check[i] == true)
    {
        if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            DisablePlayerCheckpoint(playerid);
               SetPlayerCheckpoint(playerid,HouseInfo[h][V_X],HouseInfo[h][V_Y],HouseInfo[h][V_Z],4);
        }
        else if(!IsPlayerInAnyVehicle(playerid) || GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
        {
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,HouseInfo[h][C_X],HouseInfo[h][C_Y],HouseInfo[h][C_Z],2);
        }
    }
    return 1;
}

public OnPlayerExitVehicle(playerid,vehicleid)
{
    if(IsPlayerInRangeOfPoint(playerid,10,HouseInfo[h][H_X],HouseInfo[h][H_Y],HouseInfo[h][H_Z]) && check[i] == true)
    {
        if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            DisablePlayerCheckpoint(playerid);
               SetPlayerCheckpoint(playerid,HouseInfo[h][V_X],HouseInfo[h][V_Y],HouseInfo[h][V_Z],4);
        }
        else if(!IsPlayerInAnyVehicle(playerid) || GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
        {
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,HouseInfo[h][C_X],HouseInfo[h][C_Y],HouseInfo[h][C_Z],2);
        }
    }
    return 1;
}

? :)

Edited by ĐaVe
Link to comment
Share on other sites

  • 0

Ty to tam stejně dáváš za sebou, takže to nepůjde.. je to ta samý, jako to mam v tom cyklu :/

 

to samy to urcite neni , vyuzil jsem tam promennou a dal jsem ti tam kontrolu kdyz hrac nastoupi a vystoupi z auta... bud hodnej a vyzkousej to a neber to jenom teoreticky

Link to comment
Share on other sites

  • 0

Zkusím to, ale zkusil jsem to pouze v příkazu - Disable a hned za to Set. Opět stejná velikost.. A když to nejde takhle v jednoduchém příkazu, pochybuji, že to pude takhle


//Nezobrazí se nic

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...