13.07.2011, 16:45
(
Последний раз редактировалось payl; 13.07.2011 в 16:48.
Причина: little bugfix
)
Quote:
What is SPAWN_Stat and where does it get set? |
0-player is choosing class/dead
1-player is waiting for spawn
2-player is spawned
OnPlayerDeath: setting 0
OnPlayerConnect: setting 0
OnPlayerSpawn: setting 1 (and SPAWN_TimeLeft).
Here is (almost) whole code:
Код:
new SPAWN_Stat[MAX_PLAYERS]; new SPAWN_TimeLeft[MAX_PLAYERS]; new Text:SPAWN_Text[MAX_PLAYERS]; public SPAWN_WaitSpawn(playerid) { if (gTeam[playerid]==TEAM_SWAT) { SetPlayerPos(playerid,-1131,1058,1347); SetPlayerInterior(playerid,10); } else { SetPlayerPos(playerid,-973,1062,1348); SetPlayerInterior(playerid,10); } SetPlayerWorldBounds(playerid,-1137,-967,1101,1019); SPAWN_TimeLeft[playerid]=15; SPAWN_Stat[playerid]=1; } public SPAWN_NormSpawn(playerid) { MIS_Spawn(playerid); SPAWN_Stat[playerid]=2; } public SPAWN_Call(playerid)//Used at OnPlayerSpawn { if (SPAWN_Stat[playerid]==0) { SPAWN_WaitSpawn(playerid); SPAWN_TimeLeft[playerid]=15; SPAWN_Stat[playerid]=1; } } public SPAWN_Timer() { for(new i=0;i<MAX_PLAYERS;i++) { if ((SPAWN_Stat[i]==1)&&(IsPlayerConnected(i))) { TextDrawHideForPlayer(i,SPAWN_Text[i]); SPAWN_TimeLeft[i]=SPAWN_TimeLeft[i]-1; if (SPAWN_TimeLeft[i]<=0) {SPAWN_Respawn(i,0);return;} new a[64]; format(a,sizeof(a),"Respawn in %d sec.",SPAWN_TimeLeft[i]); TextDrawSetString(SPAWN_Text[i],a); TextDrawShowForPlayer(i,SPAWN_Text[i]); } } } public SPAWN_Death(playerid) { SPAWN_Stat[playerid]=0; } public SPAWN_Init(playerid) { SPAWN_Stat[playerid]=0; } public SPAWN_MainInit() { for (new i=0;i<MAX_PLAYERS;i++) { SPAWN_Text[i]=TextDrawCreate(240.0,580.0,"Respawn in 15 sec."); //TextDrawAlignment(SPAWN_Text[i],2); //TextDrawFont(SPAWN_Text[i],2); //TextDrawColor(SPAWN_Text[i],COLOR_LIGHTRED); TextDrawHideForAll(SPAWN_Text[i]); } } public SPAWN_Respawn(playerid,type)//0-Normal, 1-InWaitRoom { if (!IsPlayerConnected(playerid)) {return;} if (type==0) {SPAWN_NormSpawn(playerid);}else{SPAWN_WaitSpawn(playerid);} }
Everything is connected to right callbacks - checked it.