[Pomoc]Vlasnistvo vozila

Započeo htmostar, Februar 20, 2012, 19:35:35 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 4 gostiju pregledaju ovu temu.

Skripta koju koristim: CBSRP(CL EDIT)
Detaljan opis problema: Zanima me kako mogu stavit da pise kad ulazis u vozilo cije je i koje je. Npr Ulazis u vozilo (imevozila)(id) Vlasnik:(ime vlasnika)
Dio skripte:/
Neke slike/video za lakse dobivanje pomoci(neobavezno):/


TUT Auto za odreÄ'enu osobu
By: Kiki

Evo jos jedan moj tut kako napraviti automobil za odreÄ'enu osobu:
Prvo sta trebate je staviti variablu na vrh skripte:

new Daniel; //Ime nije vazno, mozete stavljati koje god zelite

Drugi korak je stavljanje auta na u gamemod, naÄ'ite ongamemodeinit i ispod naÄ'ite AddStaticVehicle i ispod dodajte:

Daniel= AddStaticVehicle(...)

tako da server zna da je to automobil u kojeg moze uci odreÄ'ena osoba. Ako neznate koristiti AddStaticVehicle, odite ovdje http://wiki.sa-mp.com/wiki/AddStaticVehicle.

Daniel = AddStaticVehicle(451,1890.1632,1989.1708,13.4920,179.9223,6,6); //Ovo se spawnati turisma na parkingu u LV

Sad nam dolazi malo tezi dio,koristit cemo OnPlayerStateChange kako bi provjerili dali je igrac usao u auto.

public OnPlayerStateChange(playerid, newstate, oldstate)
{
   new PlayerName[24];
   GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
   if(newstate == PLAYER_STATE_DRIVER)
   {
      new Vehicle = GetPlayerVehicleID(playerid);
      if(Vehicle == Daniel)
      {
         if(strcmp(PlayerName,"Daniel_Klaic",true)) //Provjerava dali je igrac Daniel_Klaic
         {
            RemovePlayerFromVehicle(playerid); //Izbacuje igraca iz auta,ako nije Daniel_Klaic
            SendClientMessage(playerid, 0x33AA33AA, "Ovo vozilo moze voziti jedino Daniel_Klaic"); //Izbacuje poruku
         }
      }
   }
   return 1;
}
I to bi bilo to,ako ste napravili sve kao ja,trebali biste imati auto kojeg moze voziti samo Daniel. Evo i kako bi to tocno trebalo izgledati:

//Na vrhu skripte:

new Daniel;

//U OnGameModeInit ili OnFilterScriptInit

Daniel = AddStaticVehicle(451,1890.1632,1989.1708,13.4920,179.9223,6,6);

//Ispod OnPlayerStateChange

public OnPlayerStateChange(playerid, newstate, oldstate)
{
   new PlayerName[24];
   GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
   if(newstate == PLAYER_STATE_DRIVER)
   {
      new Vehicle = GetPlayerVehicleID(playerid);
      if(Vehicle == Daniel)
      {
         if(strcmp(PlayerName,"Daniel_Klaic",true))
         {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, 0x33AA33AA, "Ovo vozilo moze voziti jedino Daniel_Klaic");
         }
      }
   }
   return 1;
}
Poslednja Izmena: Februar 20, 2012, 20:40:54 POSLE PODNE od mistic144
Trazimo Mapera Koji zna sto radi,koji je ozbiljan i da mi posalje neke radove na pm i koliko je spreman vremena dnevno odvojiti na mapanje.||Nagrada 1337 Admin||

AL nama treba za igrace koji kupe auto ! Znamo i mi to napravit :S

neznam onda
Trazimo Mapera Koji zna sto radi,koji je ozbiljan i da mi posalje neke radove na pm i koliko je spreman vremena dnevno odvojiti na mapanje.||Nagrada 1337 Admin||

Napravis jednostavnu proveru tipa :

if(CarInfo[newcar][cOwned]==1)
    {
        format(string,sizeof(string),"Vozilo je registrovano na %s",CarInfo[newcar][cOwner]);
SendClientMessage(playerid, COLOR_BLUE, string);
                     }


Samo cOwned i cOwner zameni sa tvojim varijablama ...Takodje i CarInfo !

Pronadjite BPG Stari Mod u njemu ima OwnerShip i pise Vlasnik !
Izvadite iz skripte i ubacite u svoju (ako znate)  8)

Malo sam gledo modove i naso u ravens roleplay  ::)
if(IsAnOwnableCar(vehicleid))
{
    format(string,sizeof(string),"You are entering to a %s (%d)   Owner: %s",vehicle, vehicleid, CarInfo[vehicleid][cOwner]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsASalesVehicle(vehicleid))
{
    format(string,sizeof(string),"You are entering to a %s (%d)   Owner: Dealership",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string,sizeof(string),"Type /v buy to buy this car for $%d",GetVehiclePrice(vehicleid));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else
{
    if(IsAGangCar(vehicleid))
    {
    format(string,sizeof(string),"You are entering to a %s (%d)   Owner: Los Sureños Gang",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAGangCar2(vehicleid))
    {
    format(string,sizeof(string),"You are entering to a %s (%d)  Owner: Le Signatra Mafia",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAGangCar3(vehicleid))
    {
    format(string,sizeof(string),"You are entering to a %s (%d)   Owner: Yamaguchi Mafia",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAGangCar4(vehicleid))
    {
    format(string,sizeof(string),"You are entering to a %s (%d)  Owner: Chornaya Bratva Mafia",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAGangCar5(vehicleid))
    {
    format(string,sizeof(string),"You are entering to a %s (%d)   Owner: La Vice Mafia",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAGangCar6(vehicleid))
    {
    format(string,sizeof(string),"You are entering to a %s (%d)   Owner: Sons of Anarchy Gang",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAGangCar7(vehicleid))
    {
    format(string,sizeof(string),"You are entering to a %s (%d)   Owner: Hitmen Organization",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsACopCar(vehicleid))
    {
    format(string,sizeof(string),"You are entering to a %s (%d)   Owner: LSPD",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAnFbiCar(vehicleid))
    {
    format(string,sizeof(string),"You are entering to a %s (%d)   Owner: FBI",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsNgCar(vehicleid))
    {
    format(string,sizeof(string),"You are entering to a %s (%d)   Owner: National Guard",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsASwatCar(vehicleid))
    {
    format(string,sizeof(string),"You are entering to a %s (%d)   Owner: S.W.A.T",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsATacticalCar(vehicleid))
    {
    format(string,sizeof(string),"You are entering to a %s (%d)   Owner: Tactical Team",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsASpecialFCar(vehicleid))
    {
    format(string,sizeof(string),"You are entering to a %s (%d)   Owner: Special Forces",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAFiremenCar(vehicleid))
    {
    format(string,sizeof(string),"You are entering to a %s (%d)   Owner: LSFD",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else if(IsAnAmbulance(vehicleid))
    {
    format(string,sizeof(string),"You are entering to a %s (%d)   Owner: LSMD",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
else
    {
    format(string,sizeof(string),"You are entering to a %s (%d)   Owner: The State",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}

Tex

    for(new i = 0; i < sizeof(CarInfo); i++)
    {
        if(newcar == CarInfo[i][ownedvehicle])
{
    if(CarInfo[i][cOwned]==0)
    {
        TogglePlayerControllable(playerid, 0);
        CarOffered[playerid]= 1;
        new vehstats[256];
                format(vehstats, sizeof(vehstats),"{FFFFFF}Vozilo: {00C0FF}%s  {FFFFFF}  Cijena: {00C0FF}%d$\n{FFFFFF}Ako zelis {F3FF02}kupit {FFFFFF}ovo vozilo pritisni - {F81414}Kupi",CarInfo[i][cDescription],CarInfo[i][cValue]);
                ShowPlayerDialog(playerid, 2233, DIALOG_STYLE_MSGBOX, "{00C0FF}Auto na prodaji", vehstats, "Kupi", "Odustani");
return 1;
    }
    new GetNSMnS[256];
GetPlayerName(playerid,GetNSMnS,sizeof(GetNSMnS));
    if(strcmp(GetNSMnS, CarInfo[i][cOwner], false) == 0)
    {
new InComeFormat[256];
format(InComeFormat,sizeof(InComeFormat),"{FFFFFF}Dobrodosli u vozilo {F81414}%s {00C0FF}| {FFFFFF}Ime vaseg vozila: {F81414}%s",CarInfo[i][cOwner],CarInfo[i][cDescription]);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, InComeFormat);
    }
    else
    {
        RemovePlayerFromVehicle(playerid);
        new formatPlayNAM[256];
        format(formatPlayNAM,sizeof(formatPlayNAM),"{FFFFFF}Vozilo zakljucano! Vlasnik:{F81414} %s.",CarInfo[i][cOwner]);
        SendClientMessage(playerid,COLOR_GRAD2,formatPlayNAM);
    }
}
}
}

et to je sa GF moda nadam se da ce odgovarati!

Citat: Tex poslato Februar 20, 2012, 21:38:44 POSLE PODNE
    for(new i = 0; i < sizeof(CarInfo); i++)
    {
        if(newcar == CarInfo[i][ownedvehicle])
{
    if(CarInfo[i][cOwned]==0)
    {
        TogglePlayerControllable(playerid, 0);
        CarOffered[playerid]= 1;
        new vehstats[256];
                format(vehstats, sizeof(vehstats),"{FFFFFF}Vozilo: {00C0FF}%s  {FFFFFF}  Cijena: {00C0FF}%d$\n{FFFFFF}Ako zelis {F3FF02}kupit {FFFFFF}ovo vozilo pritisni - {F81414}Kupi",CarInfo[i][cDescription],CarInfo[i][cValue]);
                ShowPlayerDialog(playerid, 2233, DIALOG_STYLE_MSGBOX, "{00C0FF}Auto na prodaji", vehstats, "Kupi", "Odustani");
return 1;
    }
    new GetNSMnS[256];
GetPlayerName(playerid,GetNSMnS,sizeof(GetNSMnS));
    if(strcmp(GetNSMnS, CarInfo[i][cOwner], false) == 0)
    {
new InComeFormat[256];
format(InComeFormat,sizeof(InComeFormat),"{FFFFFF}Dobrodosli u vozilo {F81414}%s {00C0FF}| {FFFFFF}Ime vaseg vozila: {F81414}%s",CarInfo[i][cOwner],CarInfo[i][cDescription]);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, InComeFormat);
    }
    else
    {
        RemovePlayerFromVehicle(playerid);
        new formatPlayNAM[256];
        format(formatPlayNAM,sizeof(formatPlayNAM),"{FFFFFF}Vozilo zakljucano! Vlasnik:{F81414} %s.",CarInfo[i][cOwner]);
        SendClientMessage(playerid,COLOR_GRAD2,formatPlayNAM);
    }
}
}
}

et to je sa GF moda nadam se da ce odgovarati!
E hvala ja mislim da CLRP koristi ediciju GF ima takav system pa onda moze i to  :)