case DIALOG_CRATE:
{
if(response)
{
if(listitem == 0) // Combat Shotgun.
{
GivePlayerWeapon(playerid, 27, 32);
SendClientMessage(playerid, COLOR_WHITE,"* You have equiped a {FFA500}Combat Shotgun{FFFFFF}.");
if(IsValidDynamicObject(CrateObject)) DestroyDynamicObject(CrateObject);
DestroyDynamic3DTextLabel(Text3D:dynamiccrate3DText);
CrateObject = 0;
}
if(listitem == 1) // MP5.
{
GivePlayerWeapon(playerid, 29, 32);
SendClientMessage(playerid, COLOR_WHITE,"* You have equiped a {FFA500}MP5{FFFFFF}.");
if(IsValidDynamicObject(CrateObject)) DestroyDynamicObject(CrateObject);
DestroyDynamic3DTextLabel(Text3D:dynamiccrate3DText);
CrateObject = 0;
}
}
if(!response)
{
if(IsValidDynamicObject(CrateObject)) DestroyDynamicObject(CrateObject);
DestroyDynamic3DTextLabel(Text3D:dynamiccrate3DText);
CrateObject = 0;
SendClientMessageTA(-1, "{FFA500}» [CRATE] The crate has been destroyed! Another will respawn soon.");
}
}
|
why you repate same useless code so many times, build framwork for this system, at the moment this is useless garbage where you waste time adding something new.
|
new CrateObject;
new Float:g_CrateSpawns[][3] =
{
{821.9344,-1868.2295,6.7148}
{1281.3082,-2000.0718,58.2978},
{1800.3622,-2180.2473,13.5547},
{1647.9771,-2102.3044,13.5547}
};
CrateObject = CreateDynamicObject(CRATE_MODEL_ID, g_CrateSpawns[rand][0], g_CrateSpawns[rand][1], g_CrateSpawns[rand][2]-0.4, -1, -1, -1);
case DIALOG_CRATE:
{
if(IsValidDynamicObject(CrateObject)) DestroyDynamicObject(CrateObject);
DestroyDynamic3DTextLabel(Text3D:dynamiccrate3DText);
CrateObject = 0;
if(!response) return SendClientMessageTA(-1, "{FFA500}» [CRATE] The crate has been destroyed! Another will respawn soon.");
switch(listitem)
{
case 0: GivePlayerWeapon(playerid, 27, 32), SendClientMessage(playerid, COLOR_WHITE,"* You have equiped a {FFA500}Combat Shotgun{FFFFFF}.");
case 1: GivePlayerWeapon(playerid, 29, 32), SendClientMessage(playerid, COLOR_WHITE,"* You have equiped a {FFA500}MP5{FFFFFF}.");
}
}

stock const Float:g_CrateSpawns[][3] =
{
{821.9344,-1868.2295,6.7148}
{1281.3082,-2000.0718,58.2978},
{1800.3622,-2180.2473,13.5547},
{1647.9771,-2102.3044,13.5547}
};
|
He wanted to say, you could write it like this:
PS: For constant arrays, use stock const: PHP Code:
|
|
what?
Stock only tells the compiler to ignore if not used, there's no reason to use stock for that |
