Jump to content

Cerere model vanzare masina intr-un targ auto din oras


Mr Nik

Recommended Posts

Cu toate ca chiar si un model de acest sistem costa bani, maine ma apuc si iti fac unu fara mapping si fara textdraw.

Edited by K H A I N
[ Anti Flood Pack ] / Click [ Pugb SA:MP ] Click / [ TD Autorizatie ] Click
[ Created dm zone ] Click / [ Salvare vreme si timp ] Click [ Statistica a serverului ] Click
[ Sistema duel ] Click [ TD Registrare/Autorizatie ] Click [ Sistema kill/killed by ] Click
[ Sistema data si ora Click /  [ GM Anticheat ] Click   /  [ Schimbarea mersului ] Click
[ Save Camera ] Click  [ Sitema Concurs ] Click [ Projector pentru elicopter ] Click /
[ DM Zona ] Click / [ Folosirea textelor lungi ] Click / [Khain RPG] Click  / Antisobeit Click
Link to comment
Share on other sites

Uite un exemplu, spor la treaba! 

* bani nu cer dar macar un + merit :)

/* includ de care avem nevoie */

#include <a_samp>
/* */
  
new
	bool:market_car[MAX_VEHICLES], 
	playercar[MAX_PLAYERS],
	playercar_color[MAXPLAYER[2],
    players[MAX_PLAYERS][_players],
    market[MAX_MARKET_POS][_market]
;
 
/* */           
         
enum _players {
  name[MAX_PLAYER_NAME],
  cash,
  car
}
           
/* */           
static const Float:car_market[MAX_MARKET_POS] [1] = {
  { x, y , z, r }
};

enum _market {
  model,
  owner[MAX_PLAYER_NAME],
  price,
  place,
  color[2],
  Text3D:market_text,
  create_car,
  reason[60] }
           
/* */  
new nveh[][] = {
  "Landstalker", "Bra5vura", "Buffalo", "Linerunner", "Pereniel", "Sentinel", "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus", "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam", "Esperanto", "Taxi", "Washington", "Bobcat", "Mr Whoopee", "BF Injection", "Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus", "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie", "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster Truck", "Admiral", "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder", "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair", "Berkley's RC Van", "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider", "Glendale", "Oceanic", "Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy", "Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina", "Comet", "BMX", "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper", "Rancher", "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking", "Blista Compact", "Police Maverick", "Boxville", "Benson", "Mesa", "RC Goblin", "Hotring Racer", "Hotring Racer", "Bloodring Banger", "Rancher", "Super GT", "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropdust", "Stunt", "Tanker", "RoadTrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra", "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune", "Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer", "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent", "Bullet", "Clover", "Sadler", "Firetruck", "Hustler", "Intruder", "Primo", "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite", "Windsor", "Monster Truck", "Monster Truck", "Uranus", "Jester", "Sultan", "Stratum", "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito", "Freight", "Trailer", "Kart", "Mower", "Duneride", "Sweeper", "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400", "Newsvan", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club", "Trailer", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car (LS)", "Police Car (SF)", "Police Car (LV)", "Police Ranger", "Picador", "S.W.A.T. Van", "Alpha", "Phoenix", "Glendale", "Sadler", "Luggage Trailer", "Luggage Trailer", "Stair Trailer", "Boxville", "Farm Plow", "Utility Trailer" 
};

/* OnGamemodeInit */        
           
Create3DTextLabel("text", -1, x, y, z, 5.0, 0); 
AddStaticPickup(id,23, x, y, z,0);

/*  */     
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { 
  if(market_car[vehicleid]) { 
    for(new i; i < MAX_MARKET_POS; i++) { 
      if(IsPlayerInRangeOfPoint(playerid,3.0,car_market[i][0]) {
        if(!strcmp(market[i][owner],players[playerid][name],true)) ShowPlayerDialog(playerid,206,DIALOG_STYLE_MSGBOX,"Magazin","Vrei sa scot masina de la vanzare?",">","x"); 
        else ShowPlayerDialog(playerid,205,DIALOG_STYLE_MSGBOX,"Magazin","Vrei sa cumperi acest automobil?",">","x");
        ClearAnimations(playerid); 			
        SetPVarInt(playerid,"CarPlace",i); 
        SetPVarInt(playerid,"CarID",vehicleid);
        break; 
      }
    } 
  } 
  return 1; }
         
/* OnPlayerConnect */ 
GetPlayerName(playerid, players[playerid][nume],MAX_PLAYER_NAME);     
         
/* OnPlayerKeyStateChange */
	case KEY_WALK: {
      if(IsPlayerInRangeOfPoint(playerid,3.0,1104.4885,-1751.2487,13.5487)) { 
        ShowPlayerDialog(playerid,200,DIALOG_STYLE_LIST,"Magazin","1. Lista masinilor in vanzare\n2. Pune masina la vanzare",">","x");
      } 
    } 
/* OnDialogResponse */     
	case 200: { 
      if(!response) return 1; 
      switch(listitem) { 
        case 0: { 
          new str[36+38*MAX_MARKET_POS] = "Model\t\tVanzator\t\tPret\n"; 
          for(new i; i < MAX_MARKET_POS; i++) { 
            if(!market[i][model]) continue; 
            format(str,sizeof(str),"%s{FFFFFF}%d\t\t%s\t\t{93C722}$%.2f\n",str,market[i][model],market[i][owner],float(market[i][price]));
          } 
          if(strlen(str) < 40) return ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"Lista automobilelor","nu sunt in vanzare","x",""); 			 		   ShowPlayerDialog(playerid,0,DIALOG_STYLE_TABLIST_HEADERS,"Lista masini",str,"x",""); 
        } 
        case 1: {
          if(!players[playerid][car]) return SendClientMessage(playerid,-1,"Nu ai masina"); 
          ShowPlayerDialog(playerid,201,DIALOG_STYLE_INPUT,"Magazin","{FFFFFF}Cu cat vrei sa vinzi masina?",">","x"); }
      } 
    } 
    case 201: { 
      if(!response) return 1; 
      if(!strlen(inputtext)) return ShowPlayerDialog(playerid,201,DIALOG_STYLE_INPUT,"Magazin","{FFFFFF}Cu cat vrei sa vinzi masina?",">","x"); 			  SetPVarInt(playerid,"PriceCar",strval(inputtext)); 
      ShowPlayerDialog(playerid,202,DIALOG_STYLE_INPUT,"Magazin","{FFFFFF}Dece vinzi masina?",">","x"); 
    } 
    case 202: { 
      if(!response) return DeletePVar(playerid,"PriceCar");
      if(!strlen(inputtext)) return ShowPlayerDialog(playerid,202,DIALOG_STYLE_INPUT,"Magazin","{FFFFFF}Dece vinzi masina?",">","x"); 
      new market_place = -1; for(new i; i < MAX_MARKET_POS; i++) {
        if(!market[i][model]) { 
          market_place = i;
          market[i][place] = market_place; 
          market[i][price] = GetPVarInt(playerid,"PriceCar");
          market[i][model] = players[playerid][car]; 
          market[i][color] = playercar_color[playerid];
          format(market[i][owner],MAX_PLAYER_NAME,players[playerid][name]);
          format(market[i][reason],60,inputtext); 
          market[i][create_car] = CreateVehicle(market[i][model],car_market[i][0],market[i][color][0],market[i][color][1],-1); 
          market_car[market[i][create_car]] = true; 
          DestroyVehicle(playercar[playerid]); 
          players[playerid][car] = 0; static const str_[] = "Model: %s\nVanzator: %s\nPret: {4582A1}$%.2f\n%s";
          new _str[sizeof(str_)+20+MAX_PLAYER_NAME+6+60]; 
          format(_str,sizeof(_str),str_,CarName[market[i][model]-400],market[i][owner],float(market[i][price]),market[i][reason]);
          market[i][market_text] = Create3DTextLabel(_str, 0xFFFFFFFF, car_market[i][0], 15.0, 0); 
          DeletePVar(playerid,"PriceCar"); 
          SendClientMessage(playerid,-1,"Ai pus masina proprie la vanzare");
          break; 
        } 
      } 
      if(market_place == -1) return SendClientMessage(playerid,-1,"nu sunt locuri libere");
    } 
    case 205: { 
      if(!response) return 1;
      if(players[playerid][car]) return SendClientMessage(playerid,-1,"Ai deja automobil!"); 
      if(players[playerid][cash] < market[GetPVarInt(playerid,"CarPlace")][price]) return SendClientMessage(playerid,-1,"nu ai bani");
      players[playerid][cash] -= market[GetPVarInt(playerid,"CarPlace")][price];
      players[playerid][car] = market[GetPVarInt(playerid,"CarPlace")][model];
      playercar_color[playerid] = market[GetPVarInt(playerid,"CarPlace")][color];
      market[GetPVarInt(playerid,"CarPlace")][create_car] == 0;
      format(market[GetPVarInt(playerid,"CarPlace")][owner],MAX_PLAYER_NAME,"None");
      market[GetPVarInt(playerid,"CarPlace")][model] = 0;
      market_car[GetPVarInt(playerid,"CarID")] = false; 
      Delete3DTextLabel(market[GetPVarInt(playerid,"CarPlace")][market_text]);
      playercar[playerid] = GetPVarInt(playerid,"CarID"); 
      DeletePVar(playerid,"CarID"); 
      DeletePVar(playerid,"CarPlace"); 
      SendClientMessage(playerid,-1,"Ai cumparat o masina cu succes!");
    }
    case 205: {
      if(!response) return 1;
      if(players[playerid][car]) return SendClientMessage(playerid,-1,"Ai deja automobil!"); 
      players[playerid][car] = market[GetPVarInt(playerid,"CarPlace")][model];
      playercar_color[playerid] = market[GetPVarInt(playerid,"CarPlace")][color];
      market[GetPVarInt(playerid,"CarPlace")][create_car] == 0; 
      format(market[GetPVarInt(playerid,"CarPlace")][owner],MAX_PLAYER_NAME,"None"); 
      market[GetPVarInt(playerid,"CarPlace")][model] = 0;
      market_car[GetPVarInt(playerid,"CarID")] = false;
      playercar[playerid] = GetPVarInt(playerid,"CarID");
      Delete3DTextLabel(market[GetPVarInt(playerid,"CarPlace")][market_text]);
      DeletePVar(playerid,"CarID"); 
      DeletePVar(playerid,"CarPlace"); 
      SendClientMessage(playerid,-1,"Ai scos masina din manzare!"); 
	  } 
	}      

 

Edited by K H A I N
  • Like 1
[ Anti Flood Pack ] / Click [ Pugb SA:MP ] Click / [ TD Autorizatie ] Click
[ Created dm zone ] Click / [ Salvare vreme si timp ] Click [ Statistica a serverului ] Click
[ Sistema duel ] Click [ TD Registrare/Autorizatie ] Click [ Sistema kill/killed by ] Click
[ Sistema data si ora Click /  [ GM Anticheat ] Click   /  [ Schimbarea mersului ] Click
[ Save Camera ] Click  [ Sitema Concurs ] Click [ Projector pentru elicopter ] Click /
[ DM Zona ] Click / [ Folosirea textelor lungi ] Click / [Khain RPG] Click  / Antisobeit Click
Link to comment
Share on other sites

Acum 8 ore, Mr Nik a spus:

Multumesc frumos ! 

Cu placere

[ Anti Flood Pack ] / Click [ Pugb SA:MP ] Click / [ TD Autorizatie ] Click
[ Created dm zone ] Click / [ Salvare vreme si timp ] Click [ Statistica a serverului ] Click
[ Sistema duel ] Click [ TD Registrare/Autorizatie ] Click [ Sistema kill/killed by ] Click
[ Sistema data si ora Click /  [ GM Anticheat ] Click   /  [ Schimbarea mersului ] Click
[ Save Camera ] Click  [ Sitema Concurs ] Click [ Projector pentru elicopter ] Click /
[ DM Zona ] Click / [ Folosirea textelor lungi ] Click / [Khain RPG] Click  / Antisobeit Click
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.