[pomoc]HITNO organizacijski auto!

Započeo danchy, Maj 07, 2011, 16:47:14 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim:GF od mog frenda
Detaljan opis problema: Trazio sam TuTove kako napravit organizacijski auto i naso nesto..Ubacio ,ali svaki auto na serveru u koji god sjednem pise mi "nisi clan PDa i kicka me iz auta.. pomoc!!!!
Dio skripte:
Neke slike/video za lakse dobivanje pomoci(neobavezno): Stavit cu sta god bude trebalo
Poslednja Izmena: Maj 07, 2011, 16:56:07 POSLE PODNE od danchy


Citat: matematicar poslato Maj 07, 2011, 16:47:46 POSLE PODNE
pobrkao si id-ove

Evo sad cu postat sto sam napravio

EDIT:

PDcar[1] = AddStaticVehicle(596,1602.600,-1683.714,5.711,90.0,-1,-1); // LSPD
PDcar[2] = AddStaticVehicle(596,1602.493,-1687.953,5.711,90.0,-1,-1); // LSPD 2
PDcar[3] = AddStaticVehicle(596,1602.513,-1692.023,5.711,90.0,-1,-1); // LSPD 3
PDcar[4] = AddStaticVehicle(596,1602.540,-1696.046,5.711,90.0,-1,-1); // LSPD 4
PDcar[5] = AddStaticVehicle(596,1602.549,-1700.187,5.711,90.0,-1,-1); // LSPD 5
PDcar[6] = AddStaticVehicle(596,1602.529,-1704.312,5.711,90.0,-1,-1); // LSPD 6
PDcar[7] = AddStaticVehicle(599,1595.198,-1711.454,6.276,0.0,-1,-1); // Ranger
PDcar[8] = AddStaticVehicle(599,1591.521,-1711.476,6.276,0.0,-1,-1); // Ranger 2
PDcar[9] = AddStaticVehicle(599,1587.580,-1711.529,6.276,0.0,-1,-1); // Ranger 3
PDcar[10] = AddStaticVehicle(599,1583.369,-1711.532,6.276,0.0,-1,-1); // Ranger 4
PDcar[11] = AddStaticVehicle(598,1578.793,-1711.839,5.761,0.0,-1,-1); // LVPD
PDcar[12] = AddStaticVehicle(598,1574.278,-1711.767,5.761,0.0,-1,-1); // LVPD 2
PDcar[13] = AddStaticVehicle(598,1570.645,-1711.771,5.761,0.0,-1,-1); // LVPD 3
PDcar[14] = AddStaticVehicle(598,1565.169,-1711.816,5.761,0.0,-1,-1); // LVPD 4
PDcar[15] = AddStaticVehicle(598,1559.101,-1711.790,5.761,0.0,-1,-1); // LVPD 5
PDcar[16] = AddStaticVehicle(598,1603.983,-1630.339,13.350,90.0,-1,-1); // LVPD
PDcar[17] = AddStaticVehicle(598,1603.942,-1626.540,13.350,90.0,-1,-1); // LVPD 2
PDcar[18] = AddStaticVehicle(598,1603.991,-1622.874,13.350,90.0,-1,-1); // LVPD 3
PDcar[19] = AddStaticVehicle(598,1604.054,-1619.037,13.350,90.0,-1,-1); // LVPD 4
PDcar[20] = AddStaticVehicle(596,1604.108,-1612.621,13.330,90.0,-1,-1); // LSPD
PDcar[21] = AddStaticVehicle(596,1604.153,-1607.746,13.330,90.0,-1,-1); // LSPD
PDcar[22] = AddStaticVehicle(497,1573.178,-1652.705,28.661,0.0,-1,-1); // Police malerick
PDcar[23] = AddStaticVehicle(497,1557.158,-1652.701,28.661,0.0,-1,-1); // Police maverick 2
PDcar[24] = AddStaticVehicle(497,1564.707,-1643.221,28.661,0.0,-1,-1); // Police maverick 3






public OnPlayerStateChange(playerid, newstate, oldstate)
{
  if(newstate == PLAYER_STATE_DRIVER && PDcar[24])
    {
        //What to do?
        //Maybe
        SendClientMessage(playerid, 0xFF0000FF, "Nisi clan PDa!");
        RemovePlayerFromVehicle(playerid);
        return 1;
    }
    return 0;

}



i ovonew PDcar[25];
Poslednja Izmena: Maj 07, 2011, 16:50:03 POSLE PODNE od danchy

Citat: danchy poslato Maj 07, 2011, 16:48:10 POSLE PODNE
i ovonew PDcar[25];

[25] koristis ako si brojanje krenuo od 0,1,2,3,4,5........ a ti si poceo od 1,2,3,4,5......... znaci stavi new PDcar[24]; i nece se pomijesat ID-ovi -.-''
Poslednja Izmena: Maj 07, 2011, 17:43:23 POSLE PODNE od [ЯPF] !K4[Я]!K3

Citat: [ЯPF] !K4[Я]!K3 poslato Maj 07, 2011, 17:41:10 POSLE PODNE
Citat: danchy poslato Maj 07, 2011, 16:48:10 POSLE PODNE
i ovonew PDcar[25];

[25] koristis ako si brojanje krenuo od 0,1,2,3,4,5........ a ti si poceo od 1,2,3,4,5......... znaci stavi new PDcar[24]; i nece se pomijesat ID-ovi -.-''

C:\Users\jelly\Desktop\New Folder\filterscripts\PDa.pwn(70) : error 032: array index out of bounds (variable "PDcar")
C:\Users\jelly\Desktop\New Folder\filterscripts\PDa.pwn(71) : warning 217: loose indentation
C:\Users\jelly\Desktop\New Folder\filterscripts\PDa.pwn(179) : error 032: array index out of bounds (variable "PDcar")
C:\Users\jelly\Desktop\New Folder\filterscripts\PDa.pwn(187) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.


ONDA MI OVO izbaci lol


Citat: [ЯPF] !K4[Я]!K3 poslato Maj 07, 2011, 18:58:09 POSLE PODNE
pa poredaj ih od 0 -.-'   :'(

Onda mi izbavi ovo

  C:\Users\jelly\Desktop\New Folder\filterscripts\PDa.pwn(72) : warning 217: loose indentation
C:\Users\jelly\Desktop\New Folder\filterscripts\PDa.pwn(180) : error 032: array index out of bounds (variable "PDcar")
C:\Users\jelly\Desktop\New Folder\filterscripts\PDa.pwn(188) : warning 217: loose indentation
Pawn compiler 3.2.3664           Copyright (c) 1997-2006, ITB CompuPhase


1 Error.


linija 180 je ova..                         if(newstate == PLAYER_STATE_DRIVER && PDcar[24])

Nemoj zbog tebe da zaradim neku kaznu xd

evo ti odlican tutorial http://balkan-samp.com/forum/index.php?topic=18121.0  i procitaj ga 103 puta dok ne shvatis, a sve je perfektno objasnjeno :D

Citat: [ЯPF] !K4[Я]!K3 poslato Maj 07, 2011, 19:15:11 POSLE PODNE
Nemoj zbog tebe da zaradim neku kaznu xd

evo ti odlican tutorial http://balkan-samp.com/forum/index.php?topic=18121.0  i procitaj ga 103 puta dok ne shvatis, a sve je perfektno objasnjeno :D
Ne preporucujem ti to jer je mnogo teze...


Moja preporuka:

Citat: [H]265 poslato Novembar 05, 2010, 18:14:53 POSLE PODNE
1. ( ovo cu rec neznam koji put ali kad jednostavno mi je smjesno da oni koji jos trebaju citati tutove da oni pisu tut ), Nemas POJIMA od PAWNCC provodjenju memorije, pokraj stock ti koristis public? stock moze imati optimalan argument dok public to nemoze...Evo kako bi ovaj tut trebao izgledati....




Zelite napraviti mali fix vehicleid-ova ?

1. Napravit cemo DEFINE vehicleidova na sljedeci nacin ovo ide na vrh skripte

new
     Bus[5]
;


2. Ovo ide ispod OnGameModeInit

Bus[1] = CreateVehicle(431,1801.01879883,-1928.17163086,13.63857555,0.00000000,-1,-1,1); //Bus
Bus[2] = CreateVehicle(431,1794.07202148,-1927.80859375,13.63875294,0.00000000,-1,-1,1); //Bus
Bus[3] = CreateVehicle(431,1786.14746094,-1928.43579102,13.63844681,0.00000000,-1,-1,1); //Bus
Bus[4] = CreateVehicle(431,1779.01257324,-1928.08996582,13.63859272,0.00000000,-1,-1,1); //Bus


3. Sada cemo napraviti funkciju kojom cete provjeravati jeli to vozilo "tocno"

stock BusVozila(carid)
{
if(carid == Bus[1] || carid == Bus[2] || carid == Bus[3] || carid == Bus[4])
{
return true;
}
return false;
}


4. Sada cemo provjeriti jeli igrac smije uci u vozilo

public OnPlayerStateChange(playerid,newstate,oldstate)
{
       new
       vehicleid = GetPlayerVehicleID(playerid);
       if(newstate == 2) {
       if(BusVozila(vehicleid))
       {
            if(GetPVarInt(playerid,"POSAO") != ID_POSLA_ILI_ORGANIZACIJE) return SendClientMessage(playerid,BOJA,"Nemate kljuceve!"); RemovePlayerFromVehicle(playerid);
            return true;
       } }
       return true;
}


Ja mislim da sam ja u 2 min sta sam pisao ovo bolje objasnio nego ti, i sta je najvaznije napravio sam na puno bolji nacin ali ako izostavimo ovo sve

dobar tut  :D

Citat: danchy poslato Maj 07, 2011, 19:02:05 POSLE PODNE
Citat: [ЯPF] !K4[Я]!K3 poslato Maj 07, 2011, 18:58:09 POSLE PODNE
pa poredaj ih od 0 -.-'   :'(

Onda mi izbavi ovo

  C:\Users\jelly\Desktop\New Folder\filterscripts\PDa.pwn(72) : warning 217: loose indentation
C:\Users\jelly\Desktop\New Folder\filterscripts\PDa.pwn(180) : error 032: array index out of bounds (variable "PDcar")
C:\Users\jelly\Desktop\New Folder\filterscripts\PDa.pwn(188) : warning 217: loose indentation
Pawn compiler 3.2.3664           Copyright (c) 1997-2006, ITB CompuPhase


1 Error.


linija 180 je ova..                         if(newstate == PLAYER_STATE_DRIVER && PDcar[24])

obzirom da si sada pomerio i da ti je to auto sada id 25 probaj tu umesto 24 da stavis 25

Ovako probaj:

new PDcar[24];

forward IsAPDCar(carid);

public IsAPDCar(carid)
{
for(new i = 0; i < sizeof(PDcar); i++)
{
if(carid == PDcar[i]) return 1;
}
return 0;
}


Onda dodas pod

if(newstate == PLAYER_STATE_DRIVER)

Dodas ovo

if(IsAPDCar(newcar))
{
    if(PlayerInfo[playerid][pLeader] == 1 ||PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pAdminDuty] == 1 && PlayerInfo[playerid][pAdmin] >= 6) { CanTurnEngine[playerid] = newcar; }
else
{
SafeRemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "** Niste PD clan");
}
}
return 1;


Tako nesto,ispravite me ako grijesim

I onda naravno dodas aute
         
Poslednja Izmena: Maj 07, 2011, 22:22:08 POSLE PODNE od FireMan

Citat: eXtreme poslato Maj 07, 2011, 19:57:35 POSLE PODNE
Citat: [ЯPF] !K4[Я]!K3 poslato Maj 07, 2011, 19:15:11 POSLE PODNE
Nemoj zbog tebe da zaradim neku kaznu xd

evo ti odlican tutorial http://balkan-samp.com/forum/index.php?topic=18121.0  i procitaj ga 103 puta dok ne shvatis, a sve je perfektno objasnjeno :D
Ne preporucujem ti to jer je mnogo teze...


Moja preporuka:

Citat: [H]265 poslato Novembar 05, 2010, 18:14:53 POSLE PODNE
1. ( ovo cu rec neznam koji put ali kad jednostavno mi je smjesno da oni koji jos trebaju citati tutove da oni pisu tut ), Nemas POJIMA od PAWNCC provodjenju memorije, pokraj stock ti koristis public? stock moze imati optimalan argument dok public to nemoze...Evo kako bi ovaj tut trebao izgledati....




Zelite napraviti mali fix vehicleid-ova ?

1. Napravit cemo DEFINE vehicleidova na sljedeci nacin ovo ide na vrh skripte

new
    Bus[5]
;


2. Ovo ide ispod OnGameModeInit

Bus[1] = CreateVehicle(431,1801.01879883,-1928.17163086,13.63857555,0.00000000,-1,-1,1); //Bus
Bus[2] = CreateVehicle(431,1794.07202148,-1927.80859375,13.63875294,0.00000000,-1,-1,1); //Bus
Bus[3] = CreateVehicle(431,1786.14746094,-1928.43579102,13.63844681,0.00000000,-1,-1,1); //Bus
Bus[4] = CreateVehicle(431,1779.01257324,-1928.08996582,13.63859272,0.00000000,-1,-1,1); //Bus


3. Sada cemo napraviti funkciju kojom cete provjeravati jeli to vozilo "tocno"

stock BusVozila(carid)
{
if(carid == Bus[1] || carid == Bus[2] || carid == Bus[3] || carid == Bus[4])
{
return true;
}
return false;
}


4. Sada cemo provjeriti jeli igrac smije uci u vozilo

public OnPlayerStateChange(playerid,newstate,oldstate)
{
       new
       vehicleid = GetPlayerVehicleID(playerid);
       if(newstate == 2) {
       if(BusVozila(vehicleid))
       {
            if(GetPVarInt(playerid,"POSAO") != ID_POSLA_ILI_ORGANIZACIJE) return SendClientMessage(playerid,BOJA,"Nemate kljuceve!"); RemovePlayerFromVehicle(playerid);
            return true;
       } }
       return true;
}


Ja mislim da sam ja u 2 min sta sam pisao ovo bolje objasnio nego ti, i sta je najvaznije napravio sam na puno bolji nacin ali ako izostavimo ovo sve

dobar tut  :D


Evo pratio sam ovo i uspio..Ali kad civil  sjedne u auto ne  izbaci ga..neznam zasto! :S



EDIT: I NPR UBACIM 10 TAKVIH VOZILA I KAD UDEM JEDAN OD NJIH SPAWNA MI SE AUTI LOL POMOC!
Poslednja Izmena: Maj 08, 2011, 11:37:30 PRE PODNE od danchy