30.03.2009, 19:08
Hello,
If i wanted to set a delay of 45 secs to a gate, how'd i do that..
I'm using [INC] t-Auto Gates
these are my gates:
If i wanted to set a delay of 45 secs to a gate, how'd i do that..
I'm using [INC] t-Auto Gates
these are my gates:
Код:
//--------Gates-------------- AddAutoGate(10841, 2207.830322, -3391.702148, 5.505639,0.0,0.0,90.00,2207.830322, -3391.702148, 15.105540,"-1",13); AddAutoGate(2634, 2324.563965, -3393.401855, 18.768494,0.0,0.0,00.00,2322.646484, -3393.401855, 18.768494,"-1",4);Код://THIS IS THE INCLUDE #include <a_samp> #define MAX_GATES 200 new GateCount = 0, GateTimer = -1,SomeoneNearGate[MAX_GATES]; enum gatesinfo { Created, Model, Float:closeX, Float:closeY, Float:closeZ, Float:rotX, Float:rotY, Float:rotZ, Float:openX, Float:openY, Float:openZ, NameOpen, NameEnter[24], Distance, GateObject } new Gate[MAX_GATES][gatesinfo]; /* native AddAutoGate(modelid,Float:cX,Float:cY,Float:cZ,Float:rX,Float:rY,Float:rZ,Float:oX,Float:oY,Float:oZ,namecanenter[24],open_distance) */ //put "-1" at namecanenter so that everyone can enter it stock AddAutoGate(modelid,Float:cX,Float:cY,Float:cZ,Float:rX,Float:rY,Float:rZ,Float:oX,Float:oY,Float:oZ,namecanenter[24],open_distance) { GateCount++; new ID = GateCount; Gate[ID][Created] = 1; Gate[ID][Model] = modelid; Gate[ID][closeX] = cX; Gate[ID][closeY] = cY; Gate[ID][closeZ] = cZ; Gate[ID][rotX] = rX; Gate[ID][rotY] = rY; Gate[ID][rotZ] = rZ; Gate[ID][openX] = oX; Gate[ID][openY] = oY; Gate[ID][openZ] = oZ; if(!strcmp(namecanenter,"-1",true)) Gate[ID][NameOpen] = 0; else { Gate[ID][NameOpen] = 1; format(Gate[ID][NameEnter],24,"%s",namecanenter); } Gate[ID][Distance] = open_distance; Gate[ID][GateObject] = CreateObject(modelid,cX,cY,cZ,rX,rY,rZ); if(GateTimer == -1) GateTimer = SetTimer("CheckGates",100,1); return 1; } forward CheckGates(); public CheckGates() { for(new ID = 0; ID < MAX_GATES; ID++) { if(Gate[ID][Created] == 1) { for(new i = 0; i < GetMaxPlayers(); i++) { if(IsPlayerConnected(i)) { if(GateEnter(i,ID)) { SomeoneNearGate[ID] = 1; }else { if(SomeoneNearGate[ID] == 0) { MoveObject(Gate[ID][GateObject],Gate[ID][closeX],Gate[ID][closeY],Gate[ID][closeZ],5); } } } } if(SomeoneNearGate[ID] == 1) { MoveObject(Gate[ID][GateObject],Gate[ID][openX],Gate[ID][openY],Gate[ID][openZ],5); } SomeoneNearGate[ID] = 0; } } return 1; } stock GateEnter(playerid, gateid) { if(PlayerToPoint(Gate[gateid][Distance],playerid,Gate[gateid][closeX],Gate[gateid][closeY],Gate[gateid][closeZ])) { new PlNa[24]; GetPlayerName(playerid,PlNa,24); if(Gate[gateid][NameOpen] == 1 && !strfind(PlNa,Gate[gateid][NameEnter],true)) return 1; if(Gate[gateid][NameOpen] == 0) return 1; } return 0; } stock PlayerToPoint(Float:radi,playerid,Float:x,Float:y,Float:z) { new Float:oldposx, Float:oldposy, Float:oldposz; new Float:tempposx, Float:tempposy, Float:tempposz; GetPlayerPos(playerid, oldposx, oldposy, oldposz); tempposx = (oldposx -x); tempposy = (oldposy -y); tempposz = (oldposz -z); if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) return 1; return 0; } BTW, theres an include. Tell me if i have to insert it to. Regards, Borg245