SA-MP Forums Archive
Timers doesn't create objects! HELP - 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: Timers doesn't create objects! HELP (/showthread.php?tid=314839)



Timers doesn't create objects! HELP - liinor - 31.01.2012

I have also much other things under ongamemodeinit: timers and stuff
pawn Код:
forward rebuild();
public OnGameModeInit()
{
SetTimer("rebuild",50,true);
return 1;
}
pawn Код:
public rebuild()
{
   DestroyObject(myobject);
    myobject = CreateObject(2942,-1977.75854492,113.27742004,27.33694839,0.00000000,0.00000000,180.00000000); //object(kmb_atm1) (3)
    myobject = CreateObject(2942,-28.02439117,-49.24943542,1003.18975830,0.00000000,0.00000000,2.00000000);   //object(kmb_atm1) (1)
    myobject = CreateObject(2942,1920.76562500,-1765.84606934,13.18977451,0.00000000,0.00000000,180.00000000); //object(kmb_atm1) (1)
    myobject = CreateObject(2942,-2770.04833984,770.76776123,52.15164948,0.00000000,0.00000000,0.00000000); //object(kmb_atm1) (2)
    myobject = CreateObject(1429,2318.40698242,-1151.06994629,1054.45007324,0.00000000,0.00000000,248.00000000); //Admin pankin tv

    myobject = CreateObject(2942,-1603.88830566,887.29840088,27.35924149,0.00000000,0.00000000,90.00000000); //object(kmb_atm1) (5)
    myobject = CreateObject(2942,-28.02439117,-49.24943542,1003.18975830,0.00000000,0.00000000,2.00000000);   //object(kmb_atm1) (1)
   


    new Tping[256];
    for(new i; i < MAX_PLAYERS; i++)
    {
    SendClientMessage(i,COLOR_RED,"LOOOL");
    new Ping = GetPlayerPing(i);
    if(Ping >= 0)
    {
    format(Tping,sizeof(Tping),"Your ping: ~g~~h~%i",GetPlayerPing(i));
    TextDrawSetString(pingtext[i],Tping);
    TextDrawShowForPlayer(i,pingtext[i]);
    }
    if(Ping >= 100)
    {
    format(Tping,sizeof(Tping),"Your ping: ~y~~h~%i",GetPlayerPing(i));
    TextDrawSetString(pingtext[i],Tping);
    TextDrawShowForPlayer(i,pingtext[i]);
    }
    if(Ping >= 150)
    {
    format(Tping,sizeof(Tping),"Your ping: ~p~%i",GetPlayerPing(i));
    TextDrawSetString(pingtext[i],Tping);
    TextDrawShowForPlayer(i,pingtext[i]);
    }
    if(Ping >= 200)
    {
    format(Tping,sizeof(Tping),"Your ping: ~r~~h~%i",GetPlayerPing(i));
    TextDrawSetString(pingtext[i],Tping);
    TextDrawShowForPlayer(i,pingtext[i]);
    }

    }
    return 1;
}



AW: Timers doesn't create objects! HELP - BigETI - 31.01.2012

You actually just destroy the latest created object.

Store the object ID's in an array and delete the objects by looping through the array.


Re: AW: Timers doesn't create objects! HELP - liinor - 31.01.2012

Quote:
Originally Posted by BigETI
Посмотреть сообщение
You actually just destroy the latest created object.

Store the object ID's in an array and delete the objects by looping through the array.
i know that im destroying latest created objects because them have to rebuild.