forward gggg(color[8], t);
public gggg(color[8], t)
{
if(t == 0)return 1;
new str[256];
format(str, sizeof(str), "%d, %d", color[0], color[2]);
SendClientMessageToAll(0x00FF00FF, str);
SetTimerEx("gggg", 1000, 0, "sd", color, t-1);
return 1;
}
Wtf is that code tbh?!?!
Check https://sampwiki.blast.hk/wiki/SetTimerEx |
forward ChangeGangZoneC(gangzone, color[8], time1, time2, time3, type);
public ChangeGangZoneC(gangzone, color[8], time1, time2, time3, type)
{
new color1, color2;
for(new i; i < 4; i++)color1 += GangZoneInfo[gangzone][GangZoneColor][i]*(floatround(floatpower(256, 3-i)));
for(new i; i < 4; i++)color2 += GangZoneInfo[gangzone][GangZoneColor][i+4]*(floatround(floatpower(256, 3-i)));
if(type == -1)
{
GangZoneHideForAll(GangZoneInfo[gangzone][GangZoneId]);
GangZoneShowForAll(GangZoneInfo[gangzone][GangZoneId], color1);
return 1;
}
if(time3 == 0)time3 = GetTickCount();
if((GetTickCount()-time3 > time1 || color1 == color2) && type == 1)
{
return 1;
}
for(new i; i < 4; i++)GangZoneInfo[gangzone][GangZoneColor][i] = color[i+4]+(color[i]-color[i+4])*((GetTickCount()-time3)/time1);
color1 = 0;
for(new i; i < 4; i++)color1 += GangZoneInfo[gangzone][GangZoneColor][i]*(floatround(floatpower(256, 3-i)));
GangZoneHideForAll(GangZoneInfo[gangzone][GangZoneId]);
GangZoneShowForAll(GangZoneInfo[gangzone][GangZoneId], color1);
SendClientMessageToAll(0x00FF00FF, "GGG");
SetTimerEx("ChangeGangZoneC", time2, 0, "dsdddd", gangzone, color, time1, time2, time3, type);
return 1;
}
This code is example of this code:
PHP код:
and the SetTimerEx crash my server |
forward ChangeGangZoneC(gangzone, color[8], time1, time2, time3, type);
public ChangeGangZoneC(gangzone, color[8], time1, time2, time3, type)
{
new color1, color2;
for(new i; i < 4; i++)color1 += GangZoneInfo[gangzone][GangZoneColor][i]*(floatround(floatpower(256, 3-i)));
for(new i; i < 4; i++)color2 += GangZoneInfo[gangzone][GangZoneColor][i+4]*(floatround(floatpower(256, 3-i)));
if(type == -1)
{
GangZoneHideForAll(GangZoneInfo[gangzone][GangZoneId]);
GangZoneShowForAll(GangZoneInfo[gangzone][GangZoneId], color1);
return 1;
}
if(time3 == 0)time3 = GetTickCount();
if((GetTickCount()-time3 > time1 || color1 == color2) && type == 1)
{
return 1;
}
for(new i; i < 4; i++)GangZoneInfo[gangzone][GangZoneColor][i] = color[i+4]+(color[i]-color[i+4])*((GetTickCount()-time3)/time1);
color1 = 0;
for(new i; i < 4; i++)color1 += GangZoneInfo[gangzone][GangZoneColor][i]*(floatround(floatpower(256, 3-i)));
GangZoneHideForAll(GangZoneInfo[gangzone][GangZoneId]);
GangZoneShowForAll(GangZoneInfo[gangzone][GangZoneId], color1);
SendClientMessageToAll(0x00FF00FF, "GGG");
SetTimerEx("ChangeGangZoneC", time2, 0, "dddddd", gangzone, color, time1, time2, time3, type);
return 1;
}
Thanks very much
I succeeded to solve the problem I do this: PHP код:
|