31.07.2014, 19:51
(
Последний раз редактировалось yellow; 01.08.2014 в 09:33.
)
Hey,
Got this Code
The Problem is: Only 1 Player textdraw gets updated. e.g Player A, Player b & player C are on the server. Player A has class 1, player b has class 2 & player c has class 3. Now the textdraw should update, but it updates just for on player. And the class, which should be 1 & 2 is 0.
So the class and the textdraw updates for just one player.
(sorry for my bad english)
I hope, you understand it.
Where's the mistake?
Got this Code
Код:
ocmd:start(playerid,params[]) { PrepTimer = SetTimer("prepcd",1000,true);//20 Sekunden countdown ShowTextForPlayer(); Textdraw1 = TextDrawCreate(550.000000, 399.000000, " --:--"); TextDrawBackgroundColor(Textdraw1, 255); TextDrawFont(Textdraw1, 1); TextDrawLetterSize(Textdraw1, 0.500000, 2.000000); TextDrawColor(Textdraw1, -1); TextDrawSetOutline(Textdraw1, 0); TextDrawSetProportional(Textdraw1, 1); TextDrawSetShadow(Textdraw1, 1); TextDrawUseBox(Textdraw1, 1); TextDrawBoxColor(Textdraw1, 255); TextDrawTextSize(Textdraw1, 630.000000, 0.000000); Textdraw2 = TextDrawCreate(542.000000, 392.000000, "."); TextDrawBackgroundColor(Textdraw2, 255); TextDrawFont(Textdraw2, 1); TextDrawLetterSize(Textdraw2, 9.249999, 1.000000); TextDrawColor(Textdraw2, -1); TextDrawSetOutline(Textdraw2, 0); TextDrawSetProportional(Textdraw2, 1); TextDrawSetShadow(Textdraw2, 1); TextDrawShowForAll(Textdraw1); TextDrawShowForAll(Textdraw2); return 1; } public prepcd() { if(prepcount > 1) { prepcount --; new string[20]; format(string,sizeof(string)," 00:%02d",prepcount); TextDrawSetString(Textdraw1,string); } else { KillTimer(PrepTimer); // SetTimer("Duration",4*60*100,false); new i; for(;i<MAX_PLAYERS;i++) { if(!IsPlayerConnected(i))continue; SetClass(i); } } } stock ShowTextForPlayer() { new i; for(;i<MAX_PLAYERS;i++) { if(!IsPlayerConnected(i))continue; Textdraw0[i] = CreatePlayerTextDraw(i,550.000000, 377.000000, "Preparing"); PlayerTextDrawBackgroundColor(i,Textdraw0[i], 255); PlayerTextDrawFont(i,Textdraw0[i], 1); PlayerTextDrawLetterSize(i,Textdraw0[i], 0.500000, 2.000000); PlayerTextDrawColor(i,Textdraw0[i], -1); PlayerTextDrawSetOutline(i,Textdraw0[i], 0); PlayerTextDrawSetProportional(i,Textdraw0[i], 1); PlayerTextDrawSetShadow(i,Textdraw0[i], 1); PlayerTextDrawUseBox(i,Textdraw0[i], 1); PlayerTextDrawBoxColor(i,Textdraw0[i], 255); PlayerTextDrawTextSize(i,Textdraw0[i], 630.000000, 0.000000); PlayerTextDrawShow(i,PlayerText:Textdraw0[i]); } return 1; } stock SetClass(playerid) { new randclass = random(3); printf("%d",randclass); if(randclass == 1)//inno { m_inno ++; Class[playerid] = 1; } else if(randclass == 2)//trait { m_trait++; if(m_trait > 2) { new rand2 = random(2); if(rand2 == 1) { printf("%d",rand2); m_inno ++; Class[playerid] = 1; } else if(rand2 == 2) { if(m_det == 1)return Class[playerid] = 1, m_inno ++; else Class[playerid] = 3; m_det ++; } } else Class[playerid] = 2;//sonst } else if(randclass == 3)//det { m_det ++; if(m_det > 1) { new rand3 = random(2); if(rand3 == 1) { m_inno++; Class[playerid] = 1; } else if(rand3 == 2) { if(m_trait > 2)return Class[playerid] = 1, m_inno++; else Class[playerid] = 2; m_det++; } } else Class[playerid] = 3; } new string[17]; format(string,sizeof(string),"%s",CNames[Class[playerid]]); PlayerTextDrawSetString(playerid,Textdraw0[playerid],string); printf("class: %d %d",Class[playerid],playerid); return 1; }
So the class and the textdraw updates for just one player.
(sorry for my bad english)
I hope, you understand it.
Where's the mistake?