19.02.2012, 15:25
pawn Код:
enum tolldata { Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ }
#define TOTAL_TOLLS 2
new Tolls[TOTAL_TOLLS][tolldata] = {
{1792.5, 663.29998779297, 16.89999961853, 9.4991760253906, 359.23846435547, 169.36804199219},
{1768.9000244141, 669.0, 17.10000038147, 9.4976806640625, 359.23645019531, 169.365234375}
};
public OnFilterScriptInit()
{
SetTimer("CheckPlayersNearToll", 1000, true);
for(new toll = 0; toll < TOTAL_TOLLS; toll ++) {
CreateDynamicObject(3578, Tolls[toll][X], Tolls[toll][Y], Tolls[toll][Z], Tolls[toll][rX], Tolls[toll][rY], Tolls[toll][rZ]);
}
}
forward CheckPlayersNearToll();
public CheckPlayersNearToll() {
for(new i = 0; i < MAX_PLAYERS; i ++) {
if(!IsPlayerConnected(i)) continue;
for(new toll = 0; toll < TOTAL_TOLLS; toll ++) {
if(IsPlayerInRangeOfPoint(i, 5.0, Tolls[toll][X], Tolls[toll][Y], Tolls[toll][Z])) {
//Do your code
SetTimerEx("CloseToll", 5000, false, "i", toll);
}
}
}
}
forward CloseToll(tollid);
public CloseToll(tollid) {
//Close your toll gate here.
}