15.05.2015, 08:52
Hi there!!
i am using Dropgun system by PeteShag in my gamemode
i edited it a little to my needs
but i dont know how to drop all the weapon that player has on death
help me with droping all the guns player had on death
please help me
if u find any wrongs in the code please help me with them
Thanks in advance
i am using Dropgun system by PeteShag in my gamemode
i edited it a little to my needs
but i dont know how to drop all the weapon that player has on death
help me with droping all the guns player had on death
please help me
if u find any wrongs in the code please help me with them
Thanks in advance
Код:
#include <a_samp>
#include <streamer>
#include <foreach>
#define MAX_DROP_ITEMS 500
#define COLOR_ACTION 0xFFC0CBFF
new sendername[MAX_PLAYER_NAME], DropObject[MAX_DROP_ITEMS];
enum dData
{
DropGunAmmount[2],
Float:DropGunPosX,
Float:DropGunPosY,
Float:DropGunPosZ,
DropGunVWorld,
DropGunInterior,
};
new DropInfo[MAX_DROP_ITEMS][dData];
new GunObjectIDs[200] ={
1575, 331, 333, 334, 335, 336, 337, 338, 339, 341, 321, 322, 323, 324, 325, 326, 342, 343, 344, -1, -1 , -1 ,
346, 347, 348, 349, 350, 351, 352, 353, 355, 356, 372, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367,
368, 369, 1575
};
stock GetGunObjectID(WeaponID)
{
if (WeaponID < 0 || WeaponID > 64)
{
return 1575;
}
return GunObjectIDs[WeaponID];
}
stock DropGun(playerid, GunID, GunAmmo, Float:X, Float:Y, Float:Z, world, interior)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
if(GunID != 0 && GunAmmo != 0)
{
for(new i = 0; i < sizeof(DropInfo); i++)
{
if(DropInfo[i][DropGunPosX] == 0.0 && DropInfo[i][DropGunPosY] == 0.0 && DropInfo[i][DropGunPosZ] == 0.0)
{
DropInfo[i][DropGunAmmount][0] = GunID;
DropInfo[i][DropGunAmmount][1] = GunAmmo;
DropInfo[i][DropGunPosX] = X;
DropInfo[i][DropGunPosY] = Y;
DropInfo[i][DropGunPosZ] = Z;
DropInfo[i][DropGunVWorld] = world;
DropInfo[i][DropGunInterior] = interior;
DropObject[i] = CreateDynamicObject(GetGunObjectID(GunID), X, Y, Z-1, 80.0, 0.0, 0.0, world);
return 1;
}
}
return 1;
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
DropGun(playerid, GetPlayerWeapon(playerid),GetPlayerAmmo(playerid),X,Y,Z,GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
return 1;
}
public OnPlayerUpdate(playerid)
{
for(new i = 0; i < sizeof(DropInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid, 2.0,DropInfo[i][DropGunPosX],DropInfo[i][DropGunPosY],DropInfo[i][DropGunPosZ]))
{
if(GetPlayerVirtualWorld(playerid) == DropInfo[i][DropGunVWorld] && GetPlayerInterior(playerid) == DropInfo[i][DropGunVWorld])
{
new gunname[32], str[126];
GetPlayerName(playerid, sendername, sizeof(sendername));
GetWeaponName(DropInfo[i][DropGunAmmount][0],gunname,sizeof(gunname));
format(str,sizeof(str),"~b~Press Y to pick up the %s",gunname);
GameTextForPlayer(playerid,str,3000,3);
return 1;
}
}
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_YES)
{
for(new i = 0; i < sizeof(DropInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid, 2.0,DropInfo[i][DropGunPosX],DropInfo[i][DropGunPosY],DropInfo[i][DropGunPosZ]))
{
if(GetPlayerVirtualWorld(playerid) == DropInfo[i][DropGunVWorld] && GetPlayerInterior(playerid) == DropInfo[i][DropGunVWorld])
{
new string[256];
DestroyDynamicObject(DropObject[i]);
DropInfo[i][DropGunPosX] = 0.0;
DropInfo[i][DropGunPosY] = 0.0;
DropInfo[i][DropGunPosZ] = 0.0;
DropInfo[i][DropGunAmmount][0] = 0;
DropInfo[i][DropGunAmmount][1] = 0;
GivePlayerWeapon(playerid,DropInfo[i][DropGunAmmount][0],DropInfo[i][DropGunAmmount][1]);
format(string, sizeof(string), "{FFFFFF}* You have picked up an {FF0000}%s {FFFFFF}Ammo:{FF0000} %u.", DropInfo[i][DropGunAmmount][0], DropInfo[i][DropGunAmmount][1]);
SendClientMessage(playerid, -1, string);
return 1;
}
}
}
}
return 1;
}

