28.07.2013, 20:25
My automatic games dont seem to want to open
OnGameModeInit
Timer Functions & PlayerToPoint
OnGameModeInit
pawn Код:
public OnGameModeInit()
{
SetTimer("GatesOpen",1000,1);
AdminBaseGateStatus = 0;
AdminBaseGate = CreateObject(19313, 134.52730, 1941.54346, 21.64250, 0.00000, 0.00000, 0.00000);
AddPlayerClass(173, NewbieSpawn_X,NewbieSpawn_Y,NewbieSpawn_Z , 0, 0, 0, 0, 0, 0);
return 1;
}
pawn Код:
stock PlayerToPoint(Float:radius, playerid, Float:X, Float:Y, Float:Z)
{
new Float:oldpos[3], Float:temppos[3];
GetPlayerPos(playerid, oldpos[0], oldpos[1], oldpos[2]);
temppos[0] = (oldpos[0] -X);
temppos[1] = (oldpos[1] -Y);
temppos[2] = (oldpos[2] -Z);
if(((temppos[0] < radius) && (temppos[0] > -radius)) && ((temppos[1] < radius) && (temppos[1] > -radius)) && ((temppos[2] < radius) && (temppos[2] > -radius)))
{
return true;
}
return false;
}
public GateOpen()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(PlayerToPoint(10.0, i, 134.52730, 1941.54346, 21.64250) && AdminBaseGateStatus == 0) //replace x,y,z with the gate coords
{
AdminBaseGateStatus = 1;
GloseGateId = 1;
SetTimer("GateClose",10000,0);
MoveObject(AdminBaseGate, 121.9473, 1941.5435, 21.6425, 2.0);
}
}
}
public GateClose()
{
if(GloseGateId == 1)
{
GloseGateId = -1;
MoveObject(AdminBaseGate, 134.52730, 1941.54346, 21.64250, 2.0);
}
}