04.11.2013, 12:56
Или в этом:
или в этом
Вызывается первый, он включает второй в проверке, затем по таймеру во второй врубается третий. Текстдрав во втором зависает, иногда пробивается третий паблик со своими геймтекстами, однако текстдрав не пропадает. При этом не прогружаются текстуры (стример инкогнито), не работает чат и команды. Что бы это?
PHP Code:
public Drift()
{
new Float:Angle1, Float:Angle2, Float:BySpeed, Float:ZZZ, Float:XXX, Float:YYY, Float:SpeedX;
for(new g=0;g<200;g++)
{
GetPlayerPos(g, XXX, YYY, ZZZ);
SpeedX = floatsqroot(floatadd(floatadd(floatpower(floatabs(floatsub(XXX,SavedPos[ g ][ sX ])),2),floatpower(floatabs(floatsub(YYY,SavedPos[ g ][ sY ])),2)),floatpower(floatabs(floatsub(ZZZ,SavedPos[ g ][ sZ ])),2)));
Angle1 = ReturnPlayerAngle(g);
Angle2 = GetPlayerTheoreticAngle(g);
BySpeed = floatmul(SpeedX, 12);
if(IsPlayerInAnyVehicle(g) && floatabs(floatsub(Angle1, Angle2)) > DRIFT_MINKAT && floatabs(floatsub(Angle1, Angle2)) < DRIFT_MAXKAT && BySpeed > DRIFT_SPEED)
{
if(PlayerDriftCancellation[g] > 0)KillTimer(PlayerDriftCancellation[g]);
PlayerDriftCancellation[g] = 0;
DriftPointsNow[g] += floatval(floatabs(floatsub(Angle1,Angle2))*3*(BySpeed*0.1))/10;
PlayerDriftCancellation[g] = SetTimerEx("DriftExit", 3000, 0, "d", g);
}
if(DriftPointsNow[g] > 70 && DriftPointsNow[g] < 10000)
{
TextDrawShowForPlayer(g,TDLabels);
TextDrawShowForPlayer(g,TDValueDrift[g]);
new DPs[128];
valstr(DPs,DriftPointsNow[g],false);
TextDrawSetString(TDValueDrift[g],DPs);
////////////////////////////////////////
}
SavedPos[g][sX] = XXX;
SavedPos[g][sY] = YYY;
SavedPos[g][sZ] = ZZZ;
}
}
PHP Code:
public CheckPlayerState()
{
new i,cs;
for(i=0;i<=MAX_PLAYERS;i++)
{
cs=GetPlayerState(i);
if(DriftMode[i] && cs==PLAYER_STATE_DRIVER && DriftPointsNow[i]>2)
{
new Float:h;
GetVehicleHealth(GetPlayerVehicleID(i),h);
if(h<HealthInit[i])
{
KillTimer(DriftTimer[i]);
DriftExit(i);
GameTextForPlayer(i,"~n~~n~~n~~n~~n~~n~~n~~r~DRIFT OTMEHEH!",800,5);
DriftMode[i]=false;
}
}
if(cs==PLAYER_STATE_DRIVER && DriftMode[i]==false)
{
if(GetVType(GetPlayerVehicleID(i)))
DriftMode[i]=true;
GetVehicleHealth(GetPlayerVehicleID(i),HealthInit[i]);
AutoFixBool[i]=false;
DriftTimer[i]=SetTimerEx("Drift", 200, true, "i", i);
}
else if(cs!=PLAYER_STATE_DRIVER && DriftMode[i]==true)
{
KillTimer(DriftTimer[i]);
DriftMode[i]=false;
AutoFixBool[i]=true;
}
}
return 1;
}
PHP Code:
public DriftExit(playerid)
{
PlayerDriftCancellation[playerid] = 0;
new Float:h;
GetVehicleHealth(GetPlayerVehicleID(playerid),h);
if(DriftPointsNow[playerid]>70 && DriftPointsNow[playerid]<10000 && h==HealthInit[playerid])
{
new string[80];
GivePlayerMoneyEx(playerid,DriftPointsNow[playerid]);
if(DriftPointsNow[playerid] < 500)
{
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~r~+%d~w~$",DriftPointsNow[playerid]);
}
else if(DriftPointsNow[playerid] >= 500 && DriftPointsNow[playerid] < 1000)
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~r~+1 ~w~SCORE~n~~r~+%d~w~$",DriftPointsNow[playerid]);
}
else if(DriftPointsNow[playerid] >= 1000 && DriftPointsNow[playerid] <2000)
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+2);
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~r~+2 ~w~SCORE~n~~r~+%d~w~$",DriftPointsNow[playerid]);
}
else if(DriftPointsNow[playerid] >= 2000 && DriftPointsNow[playerid] <2500)
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+3);
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~r~+3 ~w~SCORE~n~~r~+%d~w~$",DriftPointsNow[playerid]);
}
else if(DriftPointsNow[playerid] >= 2500 && DriftPointsNow[playerid] <3200)
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+4);
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~r~+4 ~w~SCORE~n~~r~+%d~w~$",DriftPointsNow[playerid]);
}
else if(DriftPointsNow[playerid] >= 3200 && DriftPointsNow[playerid] <4200)
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+5);
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~r~+5 ~w~SCORE~n~~r~+%d~w~$",DriftPointsNow[playerid]);
}
else if(DriftPointsNow[playerid] >= 4200 && DriftPointsNow[playerid] <5000)
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+6);
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~r~+6 ~w~SCORE~n~~r~+%d~w~$",DriftPointsNow[playerid]);
}
else if(DriftPointsNow[playerid] >= 5000 && DriftPointsNow[playerid] <5900)
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+7);
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~r~+7 ~w~SCORE~n~~r~+%d~w~$",DriftPointsNow[playerid]);
}
else if(DriftPointsNow[playerid] >= 5900 && DriftPointsNow[playerid] <6800)
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+8);
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~r~+8 ~w~SCORE~n~~r~+%d~w~$",DriftPointsNow[playerid]);
}
else if(DriftPointsNow[playerid] >= 6800 && DriftPointsNow[playerid] <7600)
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+9);
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~r~+9 ~w~SCORE~n~~r~+%d~w~$",DriftPointsNow[playerid]);
}
else if(DriftPointsNow[playerid] >= 7600 && DriftPointsNow[playerid] <8400)
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+10);
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~r~+10 ~w~SCORE~n~~r~+%d~w~$",DriftPointsNow[playerid]);
}
else if(DriftPointsNow[playerid] >= 8400 && DriftPointsNow[playerid] <9200)
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+11);
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~r~+11 ~w~SCORE~n~~r~+%d~w~$",DriftPointsNow[playerid]);
}
else if(DriftPointsNow[playerid] >= 9200 && DriftPointsNow[playerid] <10000)
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+12);
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~r~+12 ~w~SCORE~n~~r~+%d~w~$",DriftPointsNow[playerid]);
}
GameTextForPlayer(playerid,string,1000,5);
UpdateScore(playerid);
}
TextDrawHideForPlayer(playerid,TDLabels);
TextDrawHideForPlayer(playerid,TDValueDrift[playerid]);
AutoFixBool[playerid]=true;
SetVehicleHealth(GetPlayerVehicleID(playerid),HealthInit[playerid]);
////////////////////////////////////////////////////
DriftPointsNow[playerid] = 0;
}
PHP Code:
GetVType(vid)
{
switch(GetVehicleModel(vid))
{
case 480, 533, 439, 555, 499, 422, 482, 498, 609, 524, 578, 455, 403, 414,
582, 443, 514, 413, 515, 440, 543, 605, 459, 531, 408, 552, 478, 456, 554,
536, 575, 534, 567, 535, 566, 576, 412, 568, 424, 573, 579, 400, 500, 444,
556, 557, 489, 505, 595, 416, 433, 431, 438, 437, 523, 427, 490, 528, 561,
407, 544, 596, 597, 598, 599, 601, 420, 445, 504, 401, 518, 527, 479, 458,
542, 507, 562, 585, 419, 526, 604, 466, 492, 474, 546, 517, 410, 551, 516,
467, 600, 426, 436, 547, 405, 580, 560, 550, 549, 540, 491, 529, 421, 602,
429, 496, 402, 541, 415, 589, 587, 565, 494, 502, 503, 411, 559, 603, 475,
506, 451, 558, 477, 418, 404: return 1;
default: return 0;
}
return 0;
}