Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Plant system by PabuLetz.
- // Credits:
- // PabuLetz- created a system
- // Commands:
- // -/plant
- // -/premove
- #include <a_samp>
- new planting[MAX_PLAYERS];
- new planting1[MAX_PLAYERS];
- new planting2[MAX_PLAYERS];
- #pragma tabsize 0
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Planting System Sa:Mp");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #else
- main()
- {
- print("\n----------------------------------");
- print(" Planting System Sa:Mp");
- print("----------------------------------\n");
- }
- #endif
- public OnGameModeInit()
- {
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/plant", cmdtext, true, 10) == 0)
- {
- ShowPlayerDialog(playerid, 2014, DIALOG_STYLE_MSGBOX, "Plant", "Are you sure you want to create a plant?", "Yes", "No");
- return 1;
- }
- if (strcmp("/premove", cmdtext, true, 10) == 0)
- {
- ShowPlayerDialog(playerid, 2015, DIALOG_STYLE_MSGBOX, "Plant", "Are you sure you want to delete a plant?", "Yes", "No");
- return 1;
- }
- return 0;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == 2014)
- {
- if(response)
- {
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
- SetTimerEx("planter", 3000, false, "i", playerid);
- }
- }
- if(dialogid == 2015)
- {
- if(response)
- {
- DestroyObject(planting[playerid]);
- DestroyObject(planting1[playerid]);
- DestroyObject(planting2[playerid]);
- }
- }
- if(dialogid == 2013)
- {
- if(response)
- {
- if(listitem == 0)
- {
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- planting[playerid] = CreateObject(870,X,Y+1.5,Z,0.0,0.0,0.0,0.0);
- EditObject(playerid, planting[playerid]);
- planting[playerid] = 1;
- }
- if(listitem == 1)
- {
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- planting1[playerid] = CreateObject(675,X,Y+1.5,Z,0.0,0.0,0.0,0.0);
- EditObject(playerid, planting1[playerid]);
- planting1[playerid] = 1;
- }
- if(listitem == 2)
- {
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- planting2[playerid] = CreateObject(869,X,Y+1.5,Z,0.0,0.0,0.0,0.0);
- EditObject(playerid, planting2[playerid]);
- planting2[playerid] = 1;
- }
- }
- return 1;
- }
- return 0;
- }
- public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
- {
- new Float:oldX, Float:oldY, Float:oldZ,
- Float:oldRotX, Float:oldRotY, Float:oldRotZ;
- GetObjectPos(planting[playerid], oldX, oldY, oldZ);
- GetObjectRot(planting[playerid], oldRotX, oldRotY, oldRotZ);
- GetObjectPos(planting1[playerid], oldX, oldY, oldZ);
- GetObjectRot(planting1[playerid], oldRotX, oldRotY, oldRotZ);
- GetObjectPos(planting2[playerid], oldX, oldY, oldZ);
- GetObjectRot(planting2[playerid], oldRotX, oldRotY, oldRotZ);
- if(!playerobject)
- {
- if(!IsValidObject(planting[playerid])) return;
- MoveObject(planting[playerid], fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ);
- }
- if(!playerobject)
- {
- if(!IsValidObject(planting1[playerid])) return;
- MoveObject(planting1[playerid], fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ);
- }
- if(!playerobject)
- {
- if(!IsValidObject(planting2[playerid])) return;
- MoveObject(planting2[playerid], fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ);
- }
- if(response == EDIT_RESPONSE_FINAL)
- {
- SendClientMessage(playerid,-1,"Now a plant.");
- }
- }
- forward planter(playerid);
- public planter(playerid)
- {
- ClearAnimations(playerid);
- ShowPlayerDialog(playerid, 2013, DIALOG_STYLE_LIST, "Plant", "Floors\nGrass\nFloors 2\n", "Select", "Close");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment