Quote:
Originally Posted by Whai
|
Sorry but I don't know much about SourcePawn I just edit some basic functions of plguins sometimes.
In this code where should I add that?
Code:
bool CreateWeapon(int client, char[] classname, int itemindex, int quality, int level = 0)
{
int weapon = CreateEntityByName(classname);
if (!IsValidEntity(weapon))
{
return false;
}
char entclass[64];
GetEntityNetClass(weapon, entclass, sizeof(entclass));
SetEntData(weapon, FindSendPropInfo(entclass, "m_iItemDefinitionIndex"), itemindex);
SetEntData(weapon, FindSendPropInfo(entclass, "m_bInitialized"), 1);
SetEntData(weapon, FindSendPropInfo(entclass, "m_iEntityQuality"), quality);
if (level)
{
SetEntData(weapon, FindSendPropInfo(entclass, "m_iEntityLevel"), level);
}
else
{
SetEntData(weapon, FindSendPropInfo(entclass, "m_iEntityLevel"), GetRandomUInt(1,99));
}
switch (itemindex)
{
case 810:
{
SetEntData(weapon, FindSendPropInfo(entclass, "m_iObjectType"), 3);
}
case 998:
{
SetEntData(weapon, FindSendPropInfo(entclass, "m_nChargeResistType"), GetRandomUInt(0,2));
}
}
DispatchSpawn(weapon);
SDKCall(g_hWeaponEquip, client, weapon);
return true;
}