Jump to content
  • 0

pomoc help me cp


AdoUMfsamp

Dotaz

čaute

Mam problem

vitvoril som si 2 zavody

prvy ide pohede ale ten druhy sa uz bije s tim prvym :/ :help: :help:

 

 

 

public OnPlayerCommandText(playerid,cmdtext[])
{
if(strcmp("/rac",cmdtext,true, 10) == 0)
{
SetPlayerCheckpoint(playerid,1968.5771,1746.9778,18.5316, 10.0);
cp[playerid] = 0;
return 1;
}
if(strcmp("/race",cmdtext,true, 10) == 0)
{
SetPlayerCheckpoint(playerid,1968.5771,1746.9778,18.5316, 10.0);
zavodpir[playerid] = 0;
return 1;
}
return 0;
}
public OnPlayerEnterCheckpoint(playerid)
{
 switch(cp[playerid])
    {
        case 0:
        {
            DisablePlayerCheckpoint(playerid);
            cp[playerid]++;
            SetPlayerCheckpoint(playerid,1968.5771,1746.9778,18.5316, 10.0);
        }
        case 1:
        {
            cp[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1996.6740,1732.3876,18.5496, 10.0);
        }
                case 2:
        {
            cp[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1913.1617,1750.2401,18.5290, 10.0);
        }
        case 3:
        {
            cp[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1886.6324,1779.7869,18.5497, 10.0);
        }
        case 4:
        {
            cp[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1942.8435,1795.7686,12.3385, 10.0);
        }
        case 5:
        {
            cp[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1908.9525,1782.1555,12.3627, 10.0);
        }
        case 6:
        {
            cp[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1864.9623,1804.5625,12.1789, 10.0);
        }
        case 7:
        {
            cp[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1860.3370,1898.7789,8.4188, 10.0);
        }
        case 8:
        {
            cp[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1882.5836,1935.1665,7.2527, 10.0);
        }
                case 9:
        {
            cp[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1894.0807,1954.3418,8.6798, 10.0);
        }
                case 10:
        {
            cp[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1903.8054,1998.3967,13.3444, 10.0);
        }
                case 11:
        {
            cp[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1875.7550,2017.9141,7.2189, 10.0);
        }
                case 12:
        {
            cp[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1957.1082,1993.3154,7.3630, 10.0);
        }
                case 13:
        {
            cp[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,2050.0452,2004.7452,10.2876, 10.0);
        }
                case 14:
        {
            cp[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,2107.7236,1969.8829,10.2945, 10.0);
            cp[playerid] = 0;
            DisablePlayerCheckpoint(playerid);
            SendClientMessage(playerid, 0xFF0000FF, "Dokoncil si drift zavod zarobil si ten neaky majland 5000");
        }
    }
     switch(zavodpir[playerid])
    {
        case 15:
        {
            DisablePlayerCheckpoint(playerid);
            zavodpir[playerid]++;
            SetPlayerCheckpoint(playerid,1968.5771,1746.9778,18.5316, 10.0);
        }
        case 16:
        {
            zavodpir[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1996.6740,1732.3876,18.5496, 10.0);
        }
                case 17:
        {
            zavodpir[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1913.1617,1750.2401,18.5290, 10.0);
        }
        case 18:
        {
            zavodpir[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1886.6324,1779.7869,18.5497, 10.0);
        }
        case 19:
        {
            zavodpir[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1942.8435,1795.7686,12.3385, 10.0);
        }
        case 20:
        {
            zavodpir[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1908.9525,1782.1555,12.3627, 10.0);
        }
        case 21:
        {
            zavodpir[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1864.9623,1804.5625,12.1789, 10.0);
        }
        case 22:
        {
            zavodpir[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1860.3370,1898.7789,8.4188, 10.0);
        }
        case 23:
        {
            zavodpir[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1882.5836,1935.1665,7.2527, 10.0);
        }
                case 24:
        {
            zavodpir[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1894.0807,1954.3418,8.6798, 10.0);
        }
                case 25:
        {
            zavodpir[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1903.8054,1998.3967,13.3444, 10.0);
        }
                case 26:
        {
            zavodpir[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1875.7550,2017.9141,7.2189, 10.0);
        }
                case 27:
        {
            zavodpir[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,1957.1082,1993.3154,7.3630, 10.0);
        }
                case 28:
        {
            zavodpir[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,2050.0452,2004.7452,10.2876, 10.0);
        }
                case 29:
        {
            zavodpir[playerid]++;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid,2107.7236,1969.8829,10.2945, 10.0);
            zavodpir[playerid] = 0;
            DisablePlayerCheckpoint(playerid);
            SendClientMessage(playerid, 0xFF0000FF, "Dokoncil si zavod zarobil si ten neaky majland 5000");
        }
    }
    return 1;
}
 

 

 

Link to comment
Share on other sites

14 odpovědí na tuto otázku

Recommended Posts

  • 0

Proč je u druhého switche jako první case 15? a pak až do 29??!! :d

 switch(zavodpir[playerid])
    {
        case 15:

Je to nový switch, takže jeď zase od nuly... :d Fungovalo by ti to pouze v případě, že by si místo defaultní hodnoty 0, nastavil onu 15, to ovšem neděláš... ;)

Link to comment
Share on other sites

  • 0

Proč je u druhého switche jako první case 15? a pak až do 29??!! :d

 switch(zavodpir[playerid])
    {
        case 15:

Je to nový switch, takže jeď zase od nuly... :d Fungovalo by ti to pouze v případě, že by si místo defaultní hodnoty 0, nastavil onu 15, to ovšem neděláš... ;)

myslím si že se mu to nebude chtít přepisovat :d

Link to comment
Share on other sites

  • 0

V príkazoch kde nastavuješ hodnotu premenám tak začínaj od 1 nie od nula...

Každá premena má defaultne hodnotu 0...pre to sa ti bije prvý s druhým lebo začína vždy na tej prvej premene.

v case potom začínaj od 1 samozrejme ;)

 

public OnPlayerCommandText(playerid,cmdtext[])
{
if(strcmp("/rac",cmdtext,true, 10) == 0)
{
SetPlayerCheckpoint(playerid,1968.5771,1746.9778,18.5316, 10.0);
cp[playerid] = 1;
return 1;
}
if(strcmp("/race",cmdtext,true, 10) == 0)
{
SetPlayerCheckpoint(playerid,1968.5771,1746.9778,18.5316, 10.0);
zavodpir[playerid] = 1;
return 1;
}
return 0;
}

Edited by Mattsy
  • Líbí se mi to! (+1) 1
Link to comment
Share on other sites

  • 0

A že máš rovnaké súradnice na cp v oboch závodoch ti nevadí?

 

A tie posledné case máš nejako divné urobené

 

Pripočítaš hodnotu

Zablokuješ CP

Nastavíš CP

Vynuluješ Hodnotu

Zablokuješ CP

 

Nechápem tu logiku nejako....asi tam má byť ešte jeden case že?

Edited by Mattsy
  • Líbí se mi to! (+1) 1
Link to comment
Share on other sites

  • 0
if(strcmp("/rac",cmdtext,true, 4) == 0) //musí se shodovat ve 4 znacích -  / + r + a + c = 4
if(strcmp("/race",cmdtext,true, 5) == 0) //musí se shodovat v 5 znacích  - / + r + a + c + e = 5

Strcmp:
string1 - The first string to compare.
string2	 - The second string to compare.
ignorecase - (optional)	When set to true, the case doesn't matter - HeLLo is the same as Hello. When false, they're not the same.
length (optional)- When this length is set, the first x chars will be compared - doing "Hello" and "Hell No" with a length of 4 will say it's the same string.

V tvém případě jsi napsal race, to ovšem uspělo jak u příkazu /rac tak i /race, proto se ti to kryje. ;)

Edited by GaRGoyLeS
Link to comment
Share on other sites

  • 0
if(strcmp("/rac",cmdtext,true, 4) == 0) //musí se shodovat ve 4 znacích -  / + r + a + c = 4
if(strcmp("/race",cmdtext,true, 5) == 0) //musí se shodovat v 5 znacích  - / + r + a + c + e = 5

Strcmp:
string1 - The first string to compare.
string2	 - The second string to compare.
ignorecase - (optional)	When set to true, the case doesn't matter - HeLLo is the same as Hello. When false, they're not the same.
length (optional)- When this length is set, the first x chars will be compared - doing "Hello" and "Hell No" with a length of 4 will say it's the same string.

V tvém případě jsi napsal race, to ovšem uspělo jak u příkazu /rac tak i /race, proto se ti to kryje. ;)

 

 

blbosť....skús si dať do jedného príkazu print aj do druhého sa uvidíš že to vypíše dobre ;)

 

Aby som vysvetlil:

 

On má v kóde príkazu číslo 10 takže porovnáva 10 znakov

 

ak by mal v oboch prípadoch číslo 4 tak potom by to čo si napísal dávalo zmysel

/rac - 4 znaky

/race - 5 znakov ale posledný to už bude ignorovať 

Edited by Mattsy
Link to comment
Share on other sites

  • 0

jebajte na to lebo asi pc rozjebem skusim po neta naist neaky podobny skript a podla toho si urobim nove

:d:facepalm:  Dika za help :):hallo:

?

 

Ja som urobil všetko čo som ti napísal...vyskúšal a krásne mi to ide :d pošlem kód do pm?

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