Event system bug - 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: Event system bug (
/showthread.php?tid=613485)
Event system bug -
Loinal - 28.07.2016
I have when 2 players join the event the time remaining show in double how to fix?
PHP код:
forward textdraw2();
public textdraw2()
{
// You decrease the start time here
EventFinishTime--;
// Check if we need to start the event
if(EventFinishTime == 0)
{
/*StartYourEvent;*/
KillTimer(EventFinishTimer);
EventFinishTime = 50;
EventCountDown = false;
eventstarted = false;
eventready = false;
SendClientMessageToAll(0xFFF000FF,"* The Event Has Been Finished");
event_type = Non;
EventFinishTime = 200;
totalp_event=0;
foreach(Player,i)
{
if(InEvents[i][InEvent] == 1)
{
SpawnPlayer(i);
InEvents[i][InEvent] = 0;
TextDrawHideForPlayer(i,TDEditor_TD[2]);
TextDrawShowForPlayer(i,randommsg);
}
}
}
else
{
new string[1243];
foreach(Player,i)
{
if(InEvents[i][InEvent] == 1)
{
format(string, sizeof(string), "____________________________________________Time_Remaining_%d_seconds", EventFinishTime);
TextDrawSetString(TDEditor_TD[2], string);
TextDrawShowForAll(TDEditor_TD[2]);
}
}
}
}
Re: Event system bug -
Loinal - 28.07.2016
Any help
Re: Event system bug -
Logic_ - 28.07.2016
Quote:
Originally Posted by Loinal
Any help
|
You have done pretty silly mistakes.
PHP код:
forward textdraw2();
public textdraw2()
{
// You decrease the start time here
EventFinishTime -=1;
// Check if we need to start the event
if(EventFinishTime <= 0)
{
/*StartYourEvent;*/
KillTimer(EventFinishTimer); // you are killing the event timer
EventFinishTime = 50; // setting the event finish time to 50
EventCountDown = eventstarted = eventready = false; // sets everything to false
SendClientMessageToAll(0xFFF000FF,"* The Event Has Been Finished"); // sends msg
event_type = Non; // finishes event
EventFinishTime = 200; // increases the event time to 200, why set 50 and then 200? /*ANSWER*/
totalp_event=0; //sets another var's value to 0
foreach(new i : Player) //loop
{
if(InEvents[i][InEvent] == 1) //checks for event players
{
SpawnPlayer(i); //spawn playrers
InEvents[i][InEvent] = 0; //event var 0
TextDrawHideForPlayer(i,TDEditor_TD[2]); //hides td
TextDrawShowForPlayer(i,randommsg); //shows td
}
}
}
else
{
new string[1243]; // why the placeholder has this much value? lol?
foreach(new i : Player)
{
if(InEvents[i][InEvent] == 1)
{
format(string, sizeof(string),"____________________________________________Time_Remaining_%d_seconds", EventFinishTime);
TextDrawSetString(TDEditor_TD[2], string);
TextDrawShowForAll(TDEditor_TD[2]); // lol lol lol --> change this into TextDrawShowForPlayer(i, TDEditor_TF[2]);
}
}
}
}
Re: Event system bug -
Loinal - 29.07.2016
not working
Re: Event system bug -
Logic_ - 29.07.2016
Have you read the comments in the code? Try replying to my questions.