24.03.2008, 17:37
Buzco, i have seen a lot of your previous scripts. Your work is wasting of hardware.
Original code:
My edit:
Your code is uselessly complicated. Use less arrays, use "public" only when it is needed and use "break".
EDIT: This include doesn't require any "public" function.
Original code:
pawn Код:
forward IsInThisInteriorPickup(id);
public IsInThisInteriorPickup(id)
{
new value;
for(new shopid;shopid<MAX_SHOP;shopid++)
{
if(shopdata[shopid][used]==1)
{
if(shopdata[shopid][shoptype]==id)
{
value = 1;
}
}
}
return value;
}
forward OnPlayerEnterShop(playerid);
public OnPlayerEnterShop(playerid)
{
for(new shopid;shopid<MAX_SHOP;shopid++)
{
if(shopdata[shopid][used] == 1)
{
if (PlayerToPointBint(3.0, playerid,shopdata[shopid][enterX],shopdata[shopid][enterY],shopdata[shopid][enterZ]))
{
SetPlayerInterior(playerid,shopdata[shopid][interior]);
SetPlayerPos(playerid,shopdata[shopid][exitX],shopdata[shopid][exitY],shopdata[shopid][exitZ]);
SetPlayerVirtualWorld(playerid,shopid+1);
}
}
}
return 1;
}
pawn Код:
IsInThisInteriorPickup(id)
{
for(new shopid; shopid < MAX_SHOP; shopid++)
{
if(shopdata[shopid][used] == 1 && shopdata[shopid][shoptype] == id) return 1;
}
return 0;
}
OnPlayerEnterShop(playerid)
{
for(new shopid; shopid < MAX_SHOP; shopid++)
{
if(shopdata[shopid][used] == 1 && PlayerToPointBint(3.0, playerid,shopdata[shopid][enterX],shopdata[shopid][enterY],shopdata[shopid][enterZ]))
{
SetPlayerInterior(playerid,shopdata[shopid][interior]);
SetPlayerPos(playerid,shopdata[shopid][exitX],shopdata[shopid][exitY],shopdata[shopid][exitZ]);
SetPlayerVirtualWorld(playerid,shopid+1);
break;
}
}
}
![smiley](images/smilies/arrow.gif)
EDIT: This include doesn't require any "public" function.