[TuT] Djurine Kućne Čarolije - Kako napraviti Race (GF)

Započeo zerocoolos, Avgust 29, 2009, 22:30:47 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 3 gostiju pregledaju ovu temu.

zerocoolos


Evo kako sam ja to radio:
new drag[MAX_PLAYERS];
new dragrace;


pod forward:

forward UtrkaTimer();
forward UtrkaTimer2();
forward UtrkaTimer3();


ongamemodeinit:
dragrace = CreateObject(982, 2050.7309570313, -2493.9169921875, 13.230429649353, 0, 0, 0);

onplayercommand:
if(strcmp(cmd, "/dragracer", true) == 0)
{
   if(IsPlayerConnected(playerid))
   {
    tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Pisi: /dragracer [id igraca/Dio imena]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
if(IsPlayerConnected(giveplayerid))
{
                   if(giveplayerid != INVALID_PLAYER_ID)
   {
   GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "DragRace: %s, tebi je admin %s aktivirao utrku", giveplayer, sendername);
SendClientMessage(giveplayerid,COLOR_RED, string);
format(string, sizeof(string), "[DragRace]Igracu %s je utrku aktivirao admin %s", giveplayer, sendername);
SendAdminMessage(COLOR_GREEN, string);
                       SetPlayerRaceCheckpoint(giveplayerid, 1,1465.1482,-2493.8542,13.1253,0,0,0,20);
                       drag[giveplayerid] = 100;
}
}
}
else
{
format(string, sizeof(string), "   %d nije aktivan igrac.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
if(strcmp(cmd, "/startdragrace", true) == 0)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
        GetPlayerName(playerid, sendername, sizeof(sendername));
            SendClientMessage(playerid, COLOR_GREEN, "Aktivirao si utrku");
            format(string, sizeof(string),"*Admin %s je aktivirao DragRace",sendername);
            SendAdminMessage(COLOR_RED,string);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
       if(IsPlayerConnected(i))
       {
                  if(drag[giveplayerid] == 100)
          {
                      SendClientMessage(i,COLOR_BLUE, "Utrka ce startati za 3 sekunde");
                      GameTextForPlayer(i, "3",1000,6);
                      SetTimer("UtrkaTimer",1000,0);
      }
       }
        }
}
return 1;
}


public OnPlayerEnterRaceCheckpoint(playerid);

new string[128];
new name[MAX_PLAYER_NAME];
if(drag[playerid] == 100){ DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid, 1,1465.1482,-2493.8542,13.1253,0,0,0,20);
drag[playerid] =101;}
else if(drag[playerid] == 101) {DisablePlayerRaceCheckpoint(playerid);
{
drag[playerid] = 0;
DisablePlayerRaceCheckpoint(playerid);
  GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "DragRace : %s je upravo zavrsio utrku ", name);
SendClientMessageToAll(COLOR_LIGHTRED, string);
}
}
return 1;
}


i na kraj skripte:

public UtrkaTimer()
{
    new giveplayerid;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
     if(drag[giveplayerid] == 100)
    {
              GameTextForPlayer(i, "2",1000,6);
              SetTimer("UtrkaTimer2",1000,0);
}
}
}
}
public UtrkaTimer2()
{
    new giveplayerid;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
     if(drag[giveplayerid] == 100)
    {
              GameTextForPlayer(i, "1",1000,6);
              SetTimer("UtrkaTimer3",1000,0);
}
}
}
}
public UtrkaTimer3()
{
    new giveplayerid;
    MoveObject(dragrace,2050.73046875,-2493.9169921875,11.190228462219, 4.0);//znaci kapija se automatski spusta kad timer kaze start
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
             if(drag[giveplayerid] == 100)
    {
              GameTextForPlayer(i, "START !!!",1000,6);
}
}
}
}
Poslednja Izmena: April 19, 2010, 16:52:56 POSLE PODNE od SoaD123

zerocoolos

zadnji timer samo promijeni u ovaj:

public UtrkaTimer3()
{
    new giveplayerid;
    MoveObject(dragrace,2050.73046875,-2493.9169921875,11.190228462219, 4.0);//znaci kapija se automatski spusta kad timer kaze start
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
             if(drag[giveplayerid] == 100)
    {
              GameTextForPlayer(i, "START !!!",1000,6);
              SetPlayerRaceCheckpoint(i, 1,x1,y1,z1,x2,y2,z2,20);-----> tu mijenjaj koordinate za oba cp-a
}
}
}
}


Prvi cp: x1,y1,z1
Drugi: x2,y2,z2

Umjesto x1,y1... stavi float koordinate tvoja dva cp-a...

ja imam samo 1 cp tj on je zajednički, znaci hvata oba dvije trake vozaca,i sad kad sam ja napravio tako kako si rekao,pozovem igraca,pojavi se taj cilj(cp) i kad startam utrku kad timer odradi svoje kaze start taj cilji cp nestane(a crveni kvadratic ostane na mapi) i ja odvezem do tog kvadratica tu di bi trebo bit cilj nista se ne dogaÄ'a.jel imas jos kakvih ideja?(da negdje u komandi za pozivanje igraca nije greska,mozda samo poziva admine ili tako nesta)

iYoko

Mogu se ja malo umjesati... Jer postoji mogucnost dodavanja arrow i finish checkpointa?


Djuro pomagaj :D ,
isao sam ponovno radit race po ovom tutu i opet imam problemcic,znaci kad doÄ'em do starta pozovem igraca pise da sam pozvan,startam utrku,timer odradi svoje kad kaze start pojavi mi se prvi cp i ograda se spusti,ali kad doÄ'em do tog cp-a on stoji i dalje znaci nece se maknut i pokazat slijedeci,evo kodova pa probaj naci di je greska:

na vrhu skripte :

new dragrace;
forward UtrkaTimer();
forward UtrkaTimer2();
forward UtrkaTimer3();


public ongamemodeinit:


dragrace = CreateObject(982, 2050.7309570313, -2493.9169921875, 13.230429649353, 0, 0, 0);


public onplayercommand:


if(strcmp(cmd, "/dragracer", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
    tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Pisi: /dragracer [id igraca/Dio imena]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
if(IsPlayerConnected(giveplayerid))
{
                    if(giveplayerid != INVALID_PLAYER_ID)
    {
    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "DragRace: %s, tebi je admin %s aktivirao utrku", giveplayer, sendername);
SendClientMessage(giveplayerid,COLOR_RED, string);
format(string, sizeof(string), "[DragRace]Igracu %s je utrku aktivirao admin %s", giveplayer, sendername);
SendAdminMessage(COLOR_GREEN, string);
                        PlayerInfo[giveplayerid][pUtrka] = 1;
}
}
}
else
{
format(string, sizeof(string), "   %d nije aktivan igrac.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
if(strcmp(cmd, "/startdragrace", true) == 0)
{
if (PlayerInfo[playerid][pAdmin] >= 1)
{
         GetPlayerName(playerid, sendername, sizeof(sendername));
             SendClientMessage(playerid, COLOR_GREEN, "Aktivirao si utrku");
             format(string, sizeof(string),"*Admin %s je aktivirao DragRace",sendername);
             SendAdminMessage(COLOR_RED,string);
         for(new i = 0; i < MAX_PLAYERS; i++)
         {
        if(IsPlayerConnected(i))
        {
                   if(PlayerInfo[i][pUtrka] == 1)
           {
                       SendClientMessage(i,COLOR_BLUE, "Utrka ce startati za 3 sekunde");
                       GameTextForPlayer(i, "3",1000,6);
                       SetTimer("UtrkaTimer",1000,0);
       }
        }
         }
}
return 1;
}


public OnPlayerEnterRaceCheckpoint(playerid):


if(PlayerInfo[playerid][pUtrka] >= 2)
{
               if(PlayerToPoint(2.0, playerid,2010.2949,-2493.9670,13.1025))//cp1
               {
                       if(PlayerInfo[playerid][pUtrka] == 2)
                       {
                            PlayerInfo[playerid][pUtrka] = 3;
                            SetPlayerRaceCheckpoint(playerid, 0, 1915.4852,-2493.9519,13.1102, 1774.5427,-2493.7131,13.5547, 2.0);// kao sto vidite u race cp unosite iduci cp i onaj iza njega
   }
               }
               if(PlayerToPoint(2.0, playerid,1915.4852,-2493.9519,13.1102))//cp2
               {
                       if(PlayerInfo[playerid][pUtrka] == 3)
                       {
                            PlayerInfo[playerid][pUtrka] = 4;
                            SetPlayerRaceCheckpoint(playerid, 0,1774.5427,-2493.7131,13.5547, 1465.1482,-2493.8542,13.1253, 2.0);
                            SendClientMessage(playerid, COLOR_YELLOW, "Prosao si kroz cilj");
PlayerInfo[playerid][pUtrka] = 4+1;//da mozete i dalje vidjeti kad prolaze kroz cilj
                            DisablePlayerRaceCheckpoint(playerid);
//-------------------[Ovo je da svi oni koji su na raceu vide kad prodjete kroz cilj]
                        new sendername[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        for(new i = 0; i < MAX_PLAYERS; i++)
                            {
           if(IsPlayerConnected(i))
           {
                                    if(PlayerInfo[i][pUtrka] > 0)
                {
                            format(string, sizeof(string), "Utrka - Cilj: %s",sendername);
                                SendClientMessage(i,COLOR_WHITE , string);
                }
           }
                             }
   }
               }
}


i na kraju skripte:


public UtrkaTimer()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
    if(PlayerInfo[i][pUtrka] == 1)
    {
              GameTextForPlayer(i, "2",1000,6);
              SetTimer("UtrkaTimer2",1000,0);
}
}
}
}
public UtrkaTimer2()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
    if(PlayerInfo[i][pUtrka] == 1)
    {
              GameTextForPlayer(i, "1",1000,6);
              SetTimer("UtrkaTimer3",1000,0);
}
}
}
}
public UtrkaTimer3()
{
    MoveObject(dragrace,2050.73046875,-2493.9169921875,11.190228462219, 4.0);//znaci kapija se automatski spusta kad timer kaze start
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
              if(PlayerInfo[i][pUtrka] == 1)
    {
              GameTextForPlayer(i, "START !!!",1000,6);
               SetPlayerRaceCheckpoint(i, 0, 2010.2949,-2493.9670,13.1025, 1915.4852,-2493.9519,13.1102, 20);//cp 1
              PlayerInfo[i][pUtrka] = 2;
}
}
}
}

Plzz recte mi gdje sam pogrijesio

CitatC:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3634) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3635) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3636) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3637) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3638) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3639) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3640) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3641) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3641 -- 3642) : warning 215: expression has no effect
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3642) : error 001: expected token: ";", but found "if"
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3642) : error 036: empty statement
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3642) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664           Copyright (c) 1997-2006, ITB CompuPhase


11 Errors.

Plzz pomoc
 
Moji Radovi:
_________________________________________
_________________________________________


Citat: Night_Mare poslato April 21, 2010, 18:34:28 POSLE PODNE
Plzz recte mi gdje sam pogrijesio

CitatC:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3634) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3635) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3636) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3637) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3638) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3639) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3640) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3641) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3641 -- 3642) : warning 215: expression has no effect
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3642) : error 001: expected token: ";", but found "if"
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3642) : error 036: empty statement
C:\Documents and Settings\Servis\Desktop\Kucni server\gamemodes\RG-RP.pwn(3642) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664           Copyright (c) 1997-2006, ITB CompuPhase


11 Errors.

Plzz pomoc
postaj redove...



Sta pojasnit?

CP = Check point?


Odsutan dok ne doÄ'em.


Citat: SoaD123 poslato Maj 01, 2010, 15:37:03 POSLE PODNE
sta niko nezna di bi mogo bit problem?
fali ti DisablePlayerCheckpoint(playerid) prije SetPlayerCheckpoint, SetPlayerCheckpoint ne radi to automatski pa morate vi inace vam nece dobro raditi  ;)

zerocoolos

Citat: JoeBullet v2.1 poslato Maj 13, 2010, 12:53:33 POSLE PODNE
Citat: SoaD123 poslato Maj 01, 2010, 15:37:03 POSLE PODNE
sta niko nezna di bi mogo bit problem?
fali ti DisablePlayerCheckpoint(playerid) prije SetPlayerCheckpoint, SetPlayerCheckpoint ne radi to automatski pa morate vi inace vam nece dobro raditi  ;)

ili neka jednostavno naprave novu f-ju npr SetPlayerCheckpoint_ koja ce u sebi prvo imate DisablePlayerCheckpoint pa onda SetPlayerCheckpoint da ne moraju puno toga mijenjati...