SA-MP Forums Archive
SetTimerEx - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SetTimerEx (/showthread.php?tid=647659)



SetTimerEx - idan123 - 08.01.2018

PHP код:
forward gggg(color[8], t);
public 
gggg(color[8], t)
{
    if(
== 0)return 1;
    new 
str[256];
    
format(strsizeof(str), "%d, %d"color[0], color[2]);
    
SendClientMessageToAll(0x00FF00FFstr);
    
SetTimerEx("gggg"10000"sd"colort-1);
    return 
1;

why does the SetTimerEx crash my server?


Re: SetTimerEx - RowdyrideR - 08.01.2018

Wtf is that code tbh?!?!
Check https://sampwiki.blast.hk/wiki/SetTimerEx


Re: SetTimerEx - idan123 - 08.01.2018

Quote:
Originally Posted by RowdyrideR
Посмотреть сообщение
Wtf is that code tbh?!?!
Check https://sampwiki.blast.hk/wiki/SetTimerEx
This code is example of this code:
PHP код:
forward ChangeGangZoneC(gangzonecolor[8], time1time2time3type);
public 
ChangeGangZoneC(gangzonecolor[8], time1time2time3type)
{
    new 
color1color2;
    for(new 
i4i++)color1 += GangZoneInfo[gangzone][GangZoneColor][i]*(floatround(floatpower(2563-i)));
    for(new 
i4i++)color2 += GangZoneInfo[gangzone][GangZoneColor][i+4]*(floatround(floatpower(2563-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 
i4i++)GangZoneInfo[gangzone][GangZoneColor][i] = color[i+4]+(color[i]-color[i+4])*((GetTickCount()-time3)/time1);
    
color1 0;
    for(new 
i4i++)color1 += GangZoneInfo[gangzone][GangZoneColor][i]*(floatround(floatpower(2563-i)));
    
GangZoneHideForAll(GangZoneInfo[gangzone][GangZoneId]);
    
GangZoneShowForAll(GangZoneInfo[gangzone][GangZoneId], color1);
    
SendClientMessageToAll(0x00FF00FF"GGG");
    
SetTimerEx("ChangeGangZoneC"time20"dsdddd"gangzonecolortime1time2time3type);
    return 
1;

I put the full code in my server
and the SetTimerEx crash my server


Re: SetTimerEx - idan123 - 08.01.2018

Quote:
Originally Posted by idan123
Посмотреть сообщение
This code is example of this code:
PHP код:
forward ChangeGangZoneC(gangzonecolor[8], time1time2time3type);
public 
ChangeGangZoneC(gangzonecolor[8], time1time2time3type)
{
    new 
color1color2;
    for(new 
i4i++)color1 += GangZoneInfo[gangzone][GangZoneColor][i]*(floatround(floatpower(2563-i)));
    for(new 
i4i++)color2 += GangZoneInfo[gangzone][GangZoneColor][i+4]*(floatround(floatpower(2563-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 
i4i++)GangZoneInfo[gangzone][GangZoneColor][i] = color[i+4]+(color[i]-color[i+4])*((GetTickCount()-time3)/time1);
    
color1 0;
    for(new 
i4i++)color1 += GangZoneInfo[gangzone][GangZoneColor][i]*(floatround(floatpower(2563-i)));
    
GangZoneHideForAll(GangZoneInfo[gangzone][GangZoneId]);
    
GangZoneShowForAll(GangZoneInfo[gangzone][GangZoneId], color1);
    
SendClientMessageToAll(0x00FF00FF"GGG");
    
SetTimerEx("ChangeGangZoneC"time20"dsdddd"gangzonecolortime1time2time3type);
    return 
1;

I put the full code in my server
and the SetTimerEx crash my server
Thanks very much
I succeeded to solve the problem I do this:

PHP код:
forward ChangeGangZoneC(gangzonecolor[8], time1time2time3type);
public 
ChangeGangZoneC(gangzonecolor[8], time1time2time3type)
{
    new 
color1color2;
    for(new 
i4i++)color1 += GangZoneInfo[gangzone][GangZoneColor][i]*(floatround(floatpower(2563-i)));
    for(new 
i4i++)color2 += GangZoneInfo[gangzone][GangZoneColor][i+4]*(floatround(floatpower(2563-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 
i4i++)GangZoneInfo[gangzone][GangZoneColor][i] = color[i+4]+(color[i]-color[i+4])*((GetTickCount()-time3)/time1);
    
color1 0;
    for(new 
i4i++)color1 += GangZoneInfo[gangzone][GangZoneColor][i]*(floatround(floatpower(2563-i)));
    
GangZoneHideForAll(GangZoneInfo[gangzone][GangZoneId]);
    
GangZoneShowForAll(GangZoneInfo[gangzone][GangZoneId], color1);
    
SendClientMessageToAll(0x00FF00FF"GGG");
    
SetTimerEx("ChangeGangZoneC"time20"dddddd"gangzonecolortime1time2time3type);
    return 
1;

(look on the SetTimerEx)


Re: SetTimerEx - idan123 - 08.01.2018

Quote:
Originally Posted by idan123
Посмотреть сообщение
Thanks very much
I succeeded to solve the problem I do this:

PHP код:
forward ChangeGangZoneC(gangzonecolor[8], time1time2time3type);
public 
ChangeGangZoneC(gangzonecolor[8], time1time2time3type)
{
    new 
color1color2;
    for(new 
i4i++)color1 += GangZoneInfo[gangzone][GangZoneColor][i]*(floatround(floatpower(2563-i)));
    for(new 
i4i++)color2 += GangZoneInfo[gangzone][GangZoneColor][i+4]*(floatround(floatpower(2563-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 
i4i++)GangZoneInfo[gangzone][GangZoneColor][i] = color[i+4]+(color[i]-color[i+4])*((GetTickCount()-time3)/time1);
    
color1 0;
    for(new 
i4i++)color1 += GangZoneInfo[gangzone][GangZoneColor][i]*(floatround(floatpower(2563-i)));
    
GangZoneHideForAll(GangZoneInfo[gangzone][GangZoneId]);
    
GangZoneShowForAll(GangZoneInfo[gangzone][GangZoneId], color1);
    
SendClientMessageToAll(0x00FF00FF"GGG");
    
SetTimerEx("ChangeGangZoneC"time20"dddddd"gangzonecolortime1time2time3type);
    return 
1;

(look on the SetTimerEx)
i check it agin and it's don't work