if(strcmp(type, "gun", true) == 0)
{
if (GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");
if(GetPlayerWeapon(playerid) == 0) return SendClientMessage(playerid, COLOR_WHITE, "This is not a valid weapon.");
if (PlayerWeapons[playerid][GetPlayerWeapon(playerid)] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "The weapon you currently have in your hand is labeld a Hacked Weapon, You are either SA-MP Bugged or Cheating !");
if(GetPlayerAmmo(playerid) == 0) return SendClientMessage(playerid, COLOR_WHITE, "You do not have enough ammo to drop this weapon.");
if (IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_LIGHTRED, "You can't be in a vehicle while you use this !");
//if(GetPVarInt(playerid, "GunLic") == 1 && ResWeapon(GetPlayerWeapon(playerid))) return SendClientMessage(playerid, COLOR_GREY ,"Ammunation weapons can not be distributed.");
new gunname[128], gunid = GetPlayerWeapon(playerid), gunammo = GetPlayerAmmo(playerid);
GetWeaponName(GetPlayerWeapon(playerid), gunname, sizeof(gunname));
format(string, sizeof(string), "*** %s drops %s %s on the ground.", sendername, CheckSex(playerid),gunname);
ProxDetector(30.0, playerid, string, COLOR_PURPLE);
GetPlayerPos(playerid,X,Y,Z);
RemovePlayerWeaponEx(playerid, GetPlayerWeapon(playerid));
if(GetPVarInt(playerid, "Gloves") == 1) sendername="Unknown";
if(GetPVarInt(playerid, "Member") != 1 && GetPVarInt(playerid, "Member") != 7)
{
new amount2 = 0;
for(new i = 0; i < sizeof(DropInfo); i++)
{
if(strcmp(PlayerName(playerid), DropInfo[i][dOwner], true) == 0)
{
amount2++;
}
}
if(amount2 <= 1) DropWeapons(gunid,gunammo,X,Y,Z,GetPlayerVirtualWorld(playerid),PlayerName(playerid),sendername);
stock DropWeapons(gunID,gunAmmo,Float:X,Float:Y,Float:Z,world,owner[],print[])
{
new string[128];
if(gunID != 0 && gunAmmo != 0 && ValidDropGunID(gunID))
{
for(new i = 0; i < sizeof(DropInfo); i++)
{
if(DropInfo[i][dX] == 0.0 && DropInfo[i][dY] == 0.0 && DropInfo[i][dZ] == 0.0)
{
strmid(DropInfo[i][dOwner], owner, 0, strlen(owner), 255);
strmid(DropInfo[i][dPrint], print, 0, strlen(print), 255);
DropInfo[i][dWeapon] = gunID;
DropInfo[i][dAmmo] = gunAmmo;
DropInfo[i][dX] = X;
DropInfo[i][dY] = Y;
DropInfo[i][dZ] = Z;
DropInfo[i][dWorld] = world;
DropInfo[i][dType] = 1;
DropInfo[i][dObject] = CreateDynamicObject(GetGunObjectID(gunID), X, Y, Z-1, 80.0, 0.0, 0.0, world);
format(string, sizeof(string),"[DEBUG]: Gun Object: %d spawned using Weapon-ID: %d | Ammo-ID: %d | World %d",i,DropInfo[i][dWeapon],DropInfo[i][dAmmo],DropInfo[i][dWorld]);
printf(string);
return 1;
}
}
}
return 1;
}
new GunObjects[47][0] = { // EDIT THIS AS YOU LIKE
{0},// Emty
{331},// Brass Knuckles
{333},// Golf Club
{334},// Nitestick
{335},// Knife
{336},// Baseball Bat
{337},// Showel
{338},// Pool Cue
{339},// Katana
{341},// Chainsaw
{321},// Purple Dildo
{322},// Small White Dildo
{323},// Long White Dildo
{324},// Vibrator
{325},// Flowers
{326},// Cane
{342},// Grenade
{343},// Tear Gas
{344},// Molotov
{0},
{0},
{0},
{346},// Glock
{347},// Silenced Colt
{348},// Desert Eagle
{349},// Shotgun
{350},// Sawn Off
{351},// Combat Shotgun
{352},// Micro UZI
{353},// MP5
{355},// AK47
{356},// M4
{372},// Tec9
{357},// Rifle
{358},// Sniper Rifle
{359},// Rocket Launcher
{360},// HS Rocket Launcher
{361},// Flamethrower
{362},// Minigun
{363},// Detonator
{364},// Detonator Button
{365},// Spraycan
{366},// Fire suisher
{367},// Camera
{368},// Nightvision
{368},// Infrared Vision
{371}// Parachute
};
new Float:ObjCoords[100][3];
new object[100];
new ObjectID[100][2];
forward DeleteGun(objectid);
public DeleteGun(objectid)
{
DestroyDynamicObject(objectid);
new f = 100+1;
for(new a = 0; a < sizeof(ObjCoords); a++)
{
f = a;
break;
}
ObjCoords[f][0] = 0.0;
ObjCoords[f][1] = 0.0;
ObjCoords[f][2] = 0.0;
return 1;
}
else if(strcmp(choice,"guns",true) == 0)
{
if(GetPVarInt(playerid, "PBM") > 0)
{
SendClientMessage(playerid, COLOR_WHITE, "You're not able to do this while in a paintball game.");
return 1;
}
if(GetPVarInt(playerid, "EventToken") != 0)
{
SendClientMessage(playerid, COLOR_GREY, "You can't use this while you're in an event.");
return 1;
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
ResetPlayerWeaponsEx(playerid);
format(string, sizeof(string), "* %s has thrown away their Weapons.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
CMD:dropgun(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid)) {
SendClientMessageEx (playerid, COLOR_GRAD2, "You can not drop weapons in a vehicle!");
return 1;
}
new gunid = GetPlayerWeapon(playerid);
if(gunid) {
new f = 100+1;
for(new a = 0; a < sizeof(ObjCoords); a++) {
if(ObjCoords[a][0] == 0.0) {
f = a;
break;
}
}
if(f > 100) return SendClientMessage(playerid, COLOR_GREY, "You can not throw weapons at the moment, try back later!!");
new WeaponName[65], sendername[MAX_PLAYER_NAME];
new string[128];
GetPlayerName(playerid, sendername, sizeof(sendername));
GetWeaponName(gunid, WeaponName, 64);
if(gunid == 18) { WeaponName = "Molotovs"; }
if(gunid == 44) { WeaponName = "Nightvision Goggles"; }
if(gunid == 45) { WeaponName = "Infared Goggles"; }
RemovePlayerWeapon(playerid,gunid);
ObjectID[f][0] = gunid;
GetPlayerPos(playerid, ObjCoords[f][0], ObjCoords[f][1], ObjCoords[f][2]);
object[f] = CreateDynamicObject(GunObjects[gunid][0],ObjCoords[f][0],ObjCoords[f][1],ObjCoords[f][2]-1,93.7,120.0,120.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1, 100.0);
SetTimerEx("DeleteGun", 500000, 0, "d", object[f]);
format(string, sizeof(string), "* %s has thrown away their %s.", sendername, WeaponName);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You Don't have guns");
}
return 1;
}
Or this
PHP код:
PHP код:
|
if(IsValidDynamicObject(DropInfo[i][dObject]))
{
print("created");
}
else
{
print("not created");
}
Using a single command won't change anything (unless a value is being passed incorrectly), it just makes the code look more congested. It also seems that it's likely to be called elsewhere; there is nothing wrong with the presented layout. Check if the weapon is actually being created or if it's just too low to see.
Use something like this after the CreateDynamicObject line: pawn Код:
|
else if(strcmp(type, "weed", true) == 0)
{
if (GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");
if (GetPVarInt(playerid, "Weed") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You don't have any weed on you.");
if (IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_LIGHTRED, "You can't be in a vehicle while you use this !");
SendClientMessage(playerid, COLOR_WHITE, "You dropped your weed onto the ground.");
GetPlayerPos(playerid,X,Y,Z);
new amount2 = 0, amounto = GetPVarInt(playerid, "Weed");
SetPVarInt(playerid, "Weed", 0);
for(new i = 0; i < sizeof(DropInfo); i++)
{
if(strcmp(PlayerName(playerid), DropInfo[i][dOwner], true) == 0)
{
amount2++;
}
}
if(amount2 <= 2)
{
for(new i = 0; i < sizeof(DropInfo); i++)
{
if(DropInfo[i][dX] == 0.0 && DropInfo[i][dY] == 0.0 && DropInfo[i][dZ] == 0.0)
{
strmid(DropInfo[i][dOwner], PlayerName(playerid), 0, strlen(PlayerName(playerid)), 255);
DropInfo[i][dAmmo] = amounto;
DropInfo[i][dX] = X;
DropInfo[i][dY] = Y;
DropInfo[i][dZ] = Z;
DropInfo[i][dWorld] = GetPlayerVirtualWorld(playerid);
DropInfo[i][dType] = 2;
DropInfo[i][dObject] = CreateDynamicObject(1578, X, Y, Z-1, 0.0, 0.0, 0.0, GetPlayerVirtualWorld(playerid));
return 1;
here is the drop for weed and thats working!
PHP код:
|
CMD:dropgun(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid)) {
SendClientMessageEx (playerid, COLOR_GRAD2, "You can not drop weapons in a vehicle!");
return 1;
}
new gunid = GetPlayerWeapon(playerid);
if(gunid) {
new f = 100+1;
for(new a = 0; a < sizeof(ObjCoords); a++) {
if(ObjCoords[a][0] == 0.0) {
f = a;
break;
}
}
if(f > 100) return SendClientMessage(playerid, COLOR_GREY, "You can not throw weapons at the moment, try back later!!");
new WeaponName[65], sendername[MAX_PLAYER_NAME];
new string[128];
GetPlayerName(playerid, sendername, sizeof(sendername));
GetWeaponName(gunid, WeaponName, 64);
if(gunid == 18) { WeaponName = "Molotovs"; }
if(gunid == 44) { WeaponName = "Nightvision Goggles"; }
if(gunid == 45) { WeaponName = "Infared Goggles"; }
RemovePlayerWeapon(playerid,gunid);
ObjectID[f][0] = gunid;
GetPlayerPos(playerid, ObjCoords[f][0], ObjCoords[f][1], ObjCoords[f][2]);
object[f] = CreateDynamicObject(GunObjects[gunid][0],ObjCoords[f][0],ObjCoords[f][1],ObjCoords[f][2]-1,93.7,120.0,120.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1, 100.0);
SetTimerEx("DeleteGun", 500000, 0, "d", object[f]);
format(string, sizeof(string), "* %s has thrown away their %s.", sendername, WeaponName);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You Don't have guns");
}
return 1;
}
GetPlayerPos(playerid, ObjCoords[f][0], ObjCoords[f][1], ObjCoords[f][2]);
object[f] = CreateDynamicObject(GunObjects[gunid][0],ObjCoords[f][0],ObjCoords[f][1],ObjCoords[f][2]-1,93.7,120.0,120.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1, 100.0);
Try using my command:
PHP код:
PHP код:
|