Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // LumberJack Job Made By Me.
- // I Hope You'll Leave Credits...
- // If Not Go Fuck You're Self...
- // This Is MySql =)
- // I Hope You'll Like It!
- #include <a_samp>
- #include <a_mysql>
- #define COLOR_ORANGE 0xFFA500FF
- #define COLOR_SYSTEM 0xFFFFFFFF
- #define COLOR_YELLOW3d 0xFFFF00FF
- forward TimeDrov(playerid);
- new Text3D:cutterd;
- new cutt;
- new bool:startjobd[MAX_PLAYERS];
- new bool:woodcutter[MAX_PLAYERS];
- new timecutt[MAX_PLAYERS];
- new Oldskin[MAX_PLAYERS];
- new kgcutt[MAX_PLAYERS];
- new cuttrands;
- new pickcutt;
- new randomcutt[][1] = {
- {25},{27},{29},{28},{33},{30},{35},{32},{37},{41},{36},
- {42},{47},{52},{39},{40},{53},{54},{43},{44},{45}
- };
- public OnFilterScriptInit()
- {
- mysql_connect("localhost" , "root", "src", "123321");
- new texts[56];
- CreateObject(18259,-1897.80004883,-1971.00000000,86.59999847,0.00000000,0.00000000,0.00000000); //object(logcabinn01) (2)
- CreateObject(1463,-1892.90002441,-1984.69995117,85.50000000,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (1)
- CreateObject(1463,-1894.19995117,-1983.09997559,85.50000000,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (2)
- CreateObject(1463,-1892.40002441,-1981.00000000,85.50000000,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (3)
- CreateObject(1463,-1894.09997559,-1981.40002441,85.50000000,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (4)
- CreateObject(1463,-1892.30004883,-1982.40002441,85.50000000,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (5)
- CreateObject(1463,-1894.00000000,-1982.09997559,85.80000305,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (6)
- CreateObject(1463,-1892.40002441,-1981.59997559,85.80000305,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (7)
- CreateObject(1463,-1893.80004883,-1981.80004883,86.40000153,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (8)
- CreateObject(1463,-1894.19995117,-1982.69995117,86.09999847,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (9)
- CreateObject(1463,-1891.19995117,-1984.00000000,85.50000000,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (10)
- CreateObject(1463,-1894.90002441,-1984.90002441,85.50000000,0.00000000,0.00000000,0.00000000); //object(dyn_woodpile2) (11)
- CreateObject(14872,-1890.09997559,-1979.19995117,85.69999695,0.00000000,0.00000000,0.00000000); //object(kylie_logs) (1)
- CreateObject(14872,-1892.09997559,-2013.30004883,78.80000305,0.00000000,0.00000000,0.00000000); //object(kylie_logs) (2)
- CreateObject(14872,-1868.80004883,-2016.80004883,77.50000000,0.00000000,0.00000000,0.00000000); //object(kylie_logs) (3)
- CreateObject(848,-1872.30004883,-2005.09997559,82.40000153,0.00000000,0.00000000,0.00000000); //object(dead_tree_20) (1)
- CreateObject(684,-1888.40002441,-1973.19995117,85.69999695,3.00000000,0.00000000,0.00000000); //object(sm_fir_log02) (1)
- CreateObject(846,-1892.00000000,-2019.80004883,77.00000000,17.50000000,0.00000000,0.00000000); //object(dead_tree_18) (1)
- CreateObject(842,-1898.30004883,-1982.00000000,85.40000153,0.00000000,0.00000000,0.00000000); //object(dead_tree_14) (1)
- CreateObject(834,-1882.90002441,-2009.50000000,81.69999695,0.00000000,0.00000000,0.00000000); //object(dead_tree_7) (1)
- CreateObject(831,-1883.59997559,-1993.90002441,83.40000153,0.00000000,0.00000000,0.00000000); //object(dead_tree_5) (1)
- CreateObject(831,-1917.90002441,-1904.50000000,86.19999695,0.00000000,0.00000000,0.00000000); //object(dead_tree_5) (2)
- CreateObject(831,-1905.50000000,-1889.30004883,86.19999695,0.00000000,0.00000000,250.00000000); //object(dead_tree_5) (3)
- pickcutt = CreatePickup(1275,23,-1904.40002441,-1979.30004883,87.80000305);
- Create3DTextLabel("Inventory is empty", 0xFFA500FF, -1889.9906,-1976.1985,86.3198, 40.0, 0, 0);
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(startjobd[playerid] == true)
- {
- if(newkeys == KEY_JUMP || newkeys == KEY_FIRE || KEY_CROUCH || KEY_SECONDARY_ATTACK)
- {
- DisablePlayerCheckpoint(playerid);
- RemovePlayerAttachedObject(playerid,1);
- ApplyAnimation(playerid,"PED","IDLE_tired",4.1,0,1,1,0,1);
- SendClientMessage(playerid,0xAFAFAFAA," you drop the timber");
- SetPlayerCheckpoint(playerid, -1898.4493,-2008.8124,80.6425,1.0);
- }
- }
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- if(pickupid == pickcutt)
- {
- if(woodcutter[playerid] == true) ShowPlayerDialog(playerid,9999,DIALOG_STYLE_MSGBOX,"Operation Lumberjack","{EEADDF}>>{FFFFFF}You really want to finish the job?","Yes","No");
- else ShowPlayerDialog ( playerid, 999 , DIALOG_STYLE_MSGBOX, "Operation Lumberjack" , "{} >> EEADDF {FFFFFF} You want to start a woodcutter?" , "Yes" , "No" ) ;
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- new string[256];
- switch(dialogid)
- {
- case 999:
- {
- if(response)
- {
- if ( IsPlayerAttachedObjectSlotUsed ( playerid, 1 ) ) RemovePlayerAttachedObject ( playerid, 1 ) , // pick pickaxe
- woodcutter[playerid] = true;// work started
- Oldskin[playerid] = GetPlayerSkin(playerid);// grean triangle for the skin
- SetPlayerSkin(playerid, 133);//put the skin on hard workers
- SetPlayerCheckpoint(playerid,-1898.4493,-2008.8124,80.6425,1.0);// Put the checkpoint
- SendClientMessage(playerid, COLOR_SYSTEM, "{EEADDF}>>{FFFFFF}You Started WoodMan!");
- SendClientMessage(playerid, COLOR_SYSTEM, "{EEADDF}>>{FFFFFF}on your map marked checkpoint");
- SendClientMessage(playerid, COLOR_SYSTEM, "{EEADDF}>>{FFFFFF}Go to him to start logging");
- ApplyAnimation(playerid,"CHAINSAW","WEAPON_csaw",4.1,1,0,0,0,1);
- ClearAnimations(playerid);
- }
- }
- case 9999:
- {
- if(response)
- {
- woodcutter[playerid] = false;// player is not woodcutter
- SetPlayerSkin(playerid,Oldskin[playerid]);// Put the old skin
- DisablePlayerCheckpoint(playerid);// Harvesting emergency.
- GivePlayerMoney(playerid, kgcutt[playerid]/2);
- format(string, sizeof(string), "{EEADDF}>>{FFFFFF}You earned% d $% d for cutting hardwood",kgcutt[playerid]/2,kgcutt[playerid]);
- SendClientMessage(playerid, COLOR_SYSTEM, string);
- kgcutt[playerid] = 0;
- if(IsPlayerAttachedObjectSlotUsed(playerid,1)) RemovePlayerAttachedObject(playerid,1);
- if(IsPlayerAttachedObjectSlotUsed(playerid,2)) RemovePlayerAttachedObject(playerid,2);// took a wheelballer
- if(IsPlayerAttachedObjectSlotUsed(playerid,3)) RemovePlayerAttachedObject(playerid,3);// ^^
- }
- }
- }
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- new string[128];
- ClearAnimations(playerid);
- ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,1,0,0,1,1,1);
- if(IsPlayerInRangeOfPoint(playerid, 6.0, -1898.4493,-2008.8124,80.6425))
- {
- startjobd[playerid] = true;
- ApplyAnimation(playerid,"CHAINSAW","WEAPON_csaw",4.1,1,0,0,0,11000);
- GivePlayerWeapon(playerid, 9, 1);
- DisablePlayerCheckpoint(playerid);
- timecutt[playerid] = SetTimerEx("TimeDrov",9800,false,"i", playerid);
- return 1;
- }
- else if(IsPlayerInRangeOfPoint(playerid, 3.0, -1896.6873,-1984.3062,86.1669) && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
- {
- startjobd[playerid] = false;
- cuttrands = random(sizeof(randomcutt));
- kgcutt[playerid] += randomcutt[cuttrands][0];
- if(IsPlayerAttachedObjectSlotUsed(playerid,1)) RemovePlayerAttachedObject(playerid,1);//
- if(IsPlayerAttachedObjectSlotUsed(playerid,3)) RemovePlayerAttachedObject(playerid,3);//
- format(string, sizeof(string), "The total number of hardwood %d",kgcutt[playerid]);
- SendClientMessage(playerid, -1, string);
- format(string, sizeof(string), "You cut down hardwood %d ",randomcutt[cuttrands][0]);
- SendClientMessage(playerid, -1, string);
- // cutter+=randomcutt[cuttrands][0];
- cutt+=randomcutt[cuttrands][0];
- cutt ++;
- ApplyAnimation(playerid,"PED","IDLE_tired",4.1,1,0,0,0,2500);
- SetPlayerCheckpoint(playerid, -1898.4493,-2008.8124,80.6425,1.0);
- UpdateMine();
- return 1;
- }
- return 1;
- }
- public TimeDrov(playerid)
- {
- if(startjobd[playerid] == true)
- {
- ResetPlayerWeapons(playerid);
- SetPlayerAttachedObject(playerid, 1, 1463, 1,0.20,0.36,0.0,0.0,90.0, 0.0, 0.4, 0.3, 0.6);
- ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,1,0,0,1,1,1);
- SetPlayerCheckpoint(playerid,-1896.6873,-1984.3062,86.1669,1.0);
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- woodcutter[playerid] = false;//
- return 1;
- }
- UpdateMine()
- {
- new string[56];
- format(string,sizeof(string),"In Stock:\n %d Wood",cutt);
- Update3DTextLabelText(cutterd, COLOR_YELLOW3d, string);
- SaveMine();
- return 1;
- }
- stock SaveMine()
- {
- new ok[200];
- format(ok,sizeof(ok),"INSERT INTO mine (cutt) VALUES (%d)", cutt);
- mysql_query(ok);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement