Advertisement
Ewolutions

xJobs 2.0

Feb 24th, 2012
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.97 KB | None | 0 0
  1. #include <a_samp>
  2. #include ESF/E_GVar_P
  3. #include streamer
  4.  
  5. new JobCount = -1;
  6.  
  7.  
  8. stock AddJob(id,Float:x,Float:y,Float:z,intr,vw,bool:usem,map,pay,A,B,C,D,Z,Pl,Bl,color,name[])
  9. {
  10.     JobCount++;
  11.     SetGVarInt("ID_Povolani",id,JobCount);
  12.  
  13.     SetGVarFloat("Pozice_X",x,JobCount);
  14.     SetGVarFloat("Pozice_Y",y,JobCount);
  15.     SetGVarFloat("Pozice_Z",z,JobCount);
  16.  
  17.     SetGVarInt("Interier",intr,JobCount);
  18.     SetGVarInt("VirtualWorld",vw,JobCount);
  19.     SetGVarInt("Icona",map,JobCount);
  20.     if(usem == true)
  21.     {
  22.         CreateDynamicMapIcon(GetGVarFloat("Pozice_X",JobCount), GetGVarFloat("Pozice_Y",JobCount), GetGVarFloat("Pozice_Z",JobCount), GetGVarInt("Icona",JobCount), -1);
  23.     }
  24.     SetGVarInt("Vyplata",pay,JobCount);
  25.     SetGVarInt("Require_A",A,JobCount);
  26.     SetGVarInt("Require_B",B,JobCount);
  27.     SetGVarInt("Require_C",C,JobCount);
  28.     SetGVarInt("Require_D",D,JobCount);
  29.     SetGVarInt("Require_Z",Z,JobCount);
  30.     SetGVarInt("Require_Pl",Pl,JobCount);
  31.     SetGVarInt("Require_Bl",Bl,JobCount);
  32.     SetGVarInt("Barva",color,JobCount);
  33.     SetGVarString("Jmeno",name,JobCount);
  34.     new nmn[128];
  35.     GetGVarString("Jmeno",nmn,JobCount);
  36.     Pickup(1581,1,GetGVarFloat("Pozice_X",JobCount), GetGVarFloat("Pozice_Y",JobCount), GetGVarFloat("Pozice_Z",JobCount),GetGVarInt("VirtualWorld",JobCount),"JobPick");
  37.     new string[400];
  38.     format(string,400,"[%s]\nHrubá mzda : %d$\n=============\nLicence A %s\nLicence B %s\nLicence C\nLicence D %s\nZbrojní licence %s\nPilotní licence %s\nLodní licence %s\nStickni \"L.ALT\".",
  39.                                     nmn,GetGVarInt("Vyplaty",JobCount),YN(GetGVarInt("Require_A",JobCount)),YN(GetGVarInt("Require_B",JobCount)),YN(GetGVarInt("Require_C",JobCount)),YN(GetGVarInt("Require_D",JobCount)),YN(GetGVarInt("Require_Z",JobCount)),YN(GetGVarInt("Require_Pl",JobCount)),YN(GetGVarInt("Require_Bl",JobCount)));
  40.     Create3DTextLabel(string,0xFFFFFFFF,GetGVarFloat("Pozice_X",JobCount), GetGVarFloat("Pozice_Y",JobCount), GetGVarFloat("Pozice_Z",JobCount),40.0,GetGVarInt("VirtualWorld",JobCount),1);
  41. }
  42. stock YN(func)
  43. {
  44.     new s[5];
  45.     if(func == 0) format(s,5,"Ne");
  46.     else if(func == 1) format(s,5,"Ano");
  47.     return s;
  48. }
  49. stock GetJobID(playerid)
  50. {
  51.     for(new a = 0;a < JobCount;a++)
  52.     {
  53.         if(IsPlayerConnected(playerid))
  54.         {
  55.             if(!IsPlayerInAnyVehicle(playerid))
  56.             {
  57.                 if(IsPlayerInRangeOfPoint(playerid,1.5,GetGVarFloat("Pozice_X",a), GetGVarFloat("Pozice_Y",a), GetGVarFloat("Pozice_Z",a)))return a;
  58.             }
  59.         }
  60.     }
  61.     return -1;
  62. }
  63.  
  64.  
  65. public OnPlayerSpawn(playerid)
  66. {
  67.     new a = GetJobID(playerid);
  68.     if(GetPVarInt(playerid,"Spawn_V_Dome") == 0 && GetPVarInt(playerid,"Povolani") != 0)
  69.     {
  70.         SetPlayerPos(playerid,GetGVarFloat("Pozice_X",a), GetGVarFloat("Pozice_Y",a), GetGVarFloat("Pozice_Z",a));
  71.     }
  72.     return 1;
  73. }
  74. stock Jmeno(playerid)
  75. {
  76.     new nm[21];
  77.     GetPlayerName(playerid,nm,21);
  78.     return nm;
  79. }
  80. stock Kolegove(playerid)
  81. {
  82.     new string_b[256];
  83.     for(new i=0;i<MAX_PLAYERS;i++)
  84.     {
  85.         if(IsPlayerConnected(i) && !IsPlayerNPC(i))
  86.         {
  87.             if(GetPVarInt(playerid,"Povolani") == 0)return 0;
  88.             if(GetPVarInt(i,"Povolani") == GetPVarInt(playerid,"Povolani"))
  89.             {
  90.                 format(string_b,sizeof(string_b),"{FFFFFF}%s\n",i,Jmeno(i));
  91.             }
  92.         }
  93.     }
  94.     ShowPlayerDialog(playerid,0,DIALOG_STYLE_LIST,"Tvoji Kolegové",string_b,"Ok","Konec");
  95.     return 1;
  96. }
  97.  
  98.  
  99. public OnPlayerPickUpPickup(playerid, pickupid)
  100. {
  101.     new string[50],name[40];
  102.     GetGVarString("PickupName", name, 40, pickupid);
  103.     format(string,15,"qpick_%s",name);
  104.     if(!strcmp(name,"none",false)) CallRemoteFunction("OnPlayerPickupUpPickupEx","ii",playerid,pickupid);
  105.     else CallRemoteFunction(string,"i",playerid);
  106. }
  107.  
  108. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  109. {
  110.     new a = GetJobID(playerid);
  111.     if(IsPlayerInRangeOfPoint(playerid,1.5,GetGVarFloat("Pozice_X",a), GetGVarFloat("Pozice_Y",a), GetGVarFloat("Pozice_Z",a)))
  112.     {
  113.         if(newkeys == KEY_WALK)
  114.         {
  115.             new nmn[128];
  116.             GetGVarString("Jmeno",nmn,a);
  117.             ShowPlayerDialog(playerid,10,DIALOG_STYLE_LIST,nmn,"{FFFFFF}Zaměstnat se\nVýpověď\nKolegové","Zvolit","Odejít");
  118.         }
  119.     }
  120.     return 1;
  121. }
  122.  
  123. forward Vyplaty(playerid);
  124. public Vyplaty(playerid)
  125. {
  126.     if(GetPVarInt(playerid,"Povolani") == 0) return 0;
  127.     new Money = GetGVarInt("Vyplata",GetPVarInt(playerid,"Povolani")),string[128],str[64],string1[128];
  128.     GetGVarString("Jmeno",str,GetPVarInt(playerid,"Povolani"));
  129.     format(string,128,"------| %s |------",str);
  130.     format(string1,128,"Dostal jsi výplatu %d $",Money - random(3000));
  131.     SendClientMessage(playerid,-1,string);
  132.     SendClientMessage(playerid,-1,string1);
  133.     SendClientMessage(playerid,-1,"----------------");
  134.     return 1;
  135. }
  136.  
  137. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  138. {
  139.     if(dialogid == 10)
  140.     {
  141.         if(response == 1)
  142.         {
  143.             if(listitem == 0)
  144.             {
  145.                 if(GetPVarInt(playerid,"Povolani") != 0)return SendClientMessage(playerid,-1,"Již jsi zaměstnán");
  146.                 else if(GetPVarInt(playerid,"Povolani") == GetGVarInt("ID_Povolani",GetJobID(playerid)))return SendClientMessage(playerid,-1,"Již jsi zde zaměstnán");
  147.                 if(GetGVarInt("Require_A",GetJobID(playerid)) == 1 && GetPVarInt(playerid,"A") == 0)return SendClientMessage(playerid,-1,"Nemas Licenci A.Toto povolani ji vyzaduje");
  148.                 if(GetGVarInt("Require_B",GetJobID(playerid)) == 1 && GetPVarInt(playerid,"B") == 0)return SendClientMessage(playerid,-1,"Nemas Licenci B.Toto povolani ji vyzaduje");
  149.                 if(GetGVarInt("Require_C",GetJobID(playerid)) == 1 && GetPVarInt(playerid,"C") == 0)return SendClientMessage(playerid,-1,"Nemas Licenci C.Toto povolani ji vyzaduje");
  150.                 if(GetGVarInt("Require_D",GetJobID(playerid)) == 1 && GetPVarInt(playerid,"D") == 0)return SendClientMessage(playerid,-1,"Nemas Licenci D.Toto povolani ji vyzaduje");
  151.                 if(GetGVarInt("Require_Z",GetJobID(playerid)) == 1 && GetPVarInt(playerid,"Z") == 0)return SendClientMessage(playerid,-1,"Nemas Zbrojni licence.Toto povolani ji vyzaduje");
  152.                 if(GetGVarInt("Require_Pl",GetJobID(playerid)) == 1 && GetPVarInt(playerid,"Pl") == 0)return SendClientMessage(playerid,-1,"Nemas pilotni licenci.Toto povolani ji vyzaduje");
  153.                 if(GetGVarInt("Require_Bl",GetJobID(playerid)) == 1 && GetPVarInt(playerid,"Bl") == 0)return SendClientMessage(playerid,-1,"Nemas Lodni licenci.Toto povolani ji vyzaduje");
  154.  
  155.                 SetPVarInt(playerid,"Povolani",GetGVarInt("ID_Povolani",GetJobID(playerid)));
  156.             }
  157.             else if(listitem == 1)
  158.             {
  159.                 if(GetPVarInt(playerid,"Povolani") == 0)return SendClientMessage(playerid,-1,"Nejsi zaměstnán");
  160.                 else if(GetPVarInt(playerid,"Povolani") != GetGVarInt("ID_Povolani",GetJobID(playerid)))return SendClientMessage(playerid,-1,"Nejsi zde zaměstnán");
  161.                 SetPVarInt(playerid,"Povolani",0);
  162.             }
  163.             else if(listitem == 2)
  164.             {
  165.                 Kolegove(playerid);
  166.             }
  167.         }
  168.     }
  169.     return 1;
  170. }
  171.  
  172. public OnFilterScriptInit()
  173. {
  174.  
  175. AddJob(1,0,0,0,0,1,true,21,12,1,1,1,1,1,1,1,-1,"dfsd");
  176. return 1;
  177. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement