Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // by ino 15/12/15
- #include <a_samp>
- #include <colandreas>
- new dropitem;
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/drop", cmdtext, true, 10) == 0) {
- if (CA_IsPlayerBlocked(playerid, 3.0, -1.0)) {
- SendClientMessage(playerid, -1, "{ff0000}You can't drop item here!");
- } else {
- DropItem(playerid, 348, -0.01, 1.35, 0.0, 93.7, 120.0);
- }
- return 1;
- }
- if (strcmp("/drop2", cmdtext, true, 10) == 0) {
- if (CA_IsPlayerBlocked(playerid, 3.0, -1.0)) {
- SendClientMessage(playerid, -1, "{ff0000}You can't drop item here!");
- } else {
- DropItem(playerid, 19054, 0.75, 1.6, 0.8, 0.0, 0.0);
- }
- return 1;
- }
- if (strcmp("/drop3", cmdtext, true, 10) == 0) {
- if (CA_IsPlayerBlocked(playerid, 3.0, -1.0)) {
- SendClientMessage(playerid, -1, "{ff0000}You can't drop item here!");
- } else {
- DropItem(playerid, 359, -0.01, 1.35, 0.0, 93.7, 120.0);
- }
- return 1;
- }
- if (strcmp("/drop4", cmdtext, true, 10) == 0) {
- if (CA_IsPlayerBlocked(playerid, 3.0, -1.0)) {
- SendClientMessage(playerid, -1, "{ff0000}You can't drop item here!");
- } else {
- DropItem(playerid, 362, 0.01, 1.35, 0.0, 93.7, 120.0);
- }
- return 1;
- }
- return 0;
- }
- stock DropItem(playerid, object, Float:tolerance, Float:inFrontEnd, Float:inFront, Float:rotateX, Float:rotateY)
- {
- new Float:x, Float:y, Float:z, Float:caZ;
- GetPlayerPos(playerid, x, y, z);
- DestroyObject(dropitem);
- GetXYInFrontOfPlayer(playerid, x, y, inFront);
- dropitem = CreateObject(object, x, y, z, rotateX, rotateY, 90.0);
- GetXYInFrontOfPlayer(playerid, x, y, inFrontEnd);
- MoveObject(dropitem, x, y, z + 0.8, 5.80);
- //GetXYInFrontOfPlayer(playerid, x, y, inFront);
- CA_FindGroundZ(x, y, z, caZ);
- ApplyAnimation(playerid, "GRENADE", "WEAPON_throwu", 3.0, 0, 0, 0, 0, 0);
- SetTimerEx("MoveItem", 200, false, "iffff", playerid, x, y, caZ, tolerance);
- return 1;
- }
- forward MoveItem(playerid, Float:x, Float:y, Float:caZ, Float:tolerance);
- public MoveItem(playerid, Float:x, Float:y, Float:caZ, Float:tolerance)
- {
- MoveObject(dropitem, x, y, caZ + (tolerance), 7.70);
- return 1;
- }
- stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
- {
- // Created by Y_Less
- new Float:a;
- GetPlayerPos(playerid, x, y, a);
- GetPlayerFacingAngle(playerid, a);
- if (GetPlayerVehicleID(playerid)) {
- GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
- }
- x += (distance * floatsin(-a, degrees));
- y += (distance * floatcos(-a, degrees));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement