Another Problem
#1

This is my code for the dm event system:

Код:
public AtriDmStartTime()
{
	new string[30];
	DmEventCountDown--;

	if(DmEventCountDown == 30)
	{
		SendClientMessageToAll(0x00FF00FF, "[EVENT]: {FFFFFF}Only 30 seconds left, /join before event starts.");
	}
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{

	    	if(IsPlayerInEvent[i] == true)
	    	{
				if(DmEventCountDown > 0)
				{
					format(string, sizeof(string), "Time Left: %d", DmEventCountDown);
	    			GameTextForPlayer(i, string, 5000, 3);
				}
				else if(DmEventCountDown == 0)
				{
					if(PlayersJoinedEvent <= 1)
					{
						SendClientMessageToAll(0xFF0000AA, "[EVENT]: {FFFFFF}The event has been cancled, Not enough players!");
						IsPlayerInEvent[i] = false;
					 	PlayersJoinedEvent = 0;
						AtriDM = 0;
					 	SetPlayerHealth(i, 0);
						DmEventCountDown = 60;
		   				SetPlayerInterior(i, 0);
						DmEventTimerVar = SetTimer("DmEventT", 1800000, false);
						KillTimer(Event1SecT);
					}
					else if(PlayersJoinedEvent > 1 && IsPlayerInEvent[i] == true)
					{
						SendClientMessage(i, 0x00FF00AA, "[EVENT]: {FFFFFF}You have been unfrozen, be the last man standing to win the prize!");
		                TogglePlayerControllable(i,1);      
				    	GameTextForPlayer(i, "~w~Event ~g~Started", 5000, 3);
						DmEventCountDown = 60;
						AtriDM = 2;
						KillTimer(Event1SecT);
					}
				}
			}
		}
	}
	return 1;
}
Thing here is, it doesn't unfreeze players.
Reply
#2

Why MAX_PLAYER loop in 2017?
PHP код:
for(new 0MAX_PLAYERSi++) 
How is this function called?
PHP код:
AtriDmStartTime() 
Use [PHP] tags for code, it makes the code more readable.

Use proper naming for functions and variables, I mentioned this in your deleted thread.

Be independent, debug your code by adding a small message in the part where it should unfreeze you, if the message is not sent, this means that part is not being called.
Reply
#3

Dude don't delete the thread even if u got the help i was also typing a longass reply there its rude...
also show these :
PHP код:
PlayersJoinedEvent && IsPlayerInEvent[i] == true 
where are u doing PlayersJoinedEvent++; and the IsPLayerInEvent[playerid] =true;
Reply
#4

AtriDmStartTime()

PHP код:
public DmEventT()
{
    
SendClientMessageToAll(0x00FFFFAA"[EVENT]: {FFFFFF}Atrium deathmatch event has started, type /join to take part!");
    
AtriHealthPickup[0] = CreateDynamicPickup(124021728.2104,-1668.2876,22.6094, -118, -1100.0);
    
AtriHealthPickup[1] = CreateDynamicPickup(124021701.4614,-1648.4786,20.2194, -118, -1100.0);
    
AtriArmourPickup[0] = CreateDynamicPickup(124221734.8628,-1639.2264,20.2307, -118, -1100.0);
    
AtriArmourPickup[0] = CreateDynamicPickup(124221708.9303,-1677.3439,27.2016, -118, -1100.0);
    
AtriAdrenalinePickup CreateDynamicPickup(124121721.5195,-1672.7142,20.2234, -118, -1100.0);
    
Event1SecT SetTimer("AtriDmStartTime"1000true);
    
KillTimer(DmEventTimerVar);
    
AtriDM 1;
    return 
1;

PHP код:
CMD:forcetevent(playeridparmas)
{
    if(
PInfo[playerid][Admin] < 3) return SendClientMessage(playeridRED,"[ERROR]: {FFFFFF}You do not have the privilleges to perform this command.");

    
DmEventT();
    return 
1;

I read what you said, I deleted that thread because it was a common mistake and i was just being stupid. Though I will rewrite my code sometime in the near future. I hope you could help me with this.
Reply
#5

PHP код:
forward DeathMatchStarter();
public 
DeathMatchStarter()
{
    
gDMCountdown -= 1;
    if(
gDMCountdown)
    {
        if(
gDMCountdown == 30//SendClientMessageToAll()
        
new str[30];
        
format(strsizeof str"Time left: %d"gDMCountdown);
        
//GameTextForAll
    
}
    else
    {
        if(!
gDMPlayers// if players didnt join
        
{
            
SendClientMessageToAll(0xFF0000AA"[EVENT]: {FFFFFF}The event has been cancled, Not enough players!");
            foreach(new 
Player)
            {
                
IsPlayerInEvent[i] = false;
                
PlayersJoinedEvent 0;
                
AtriDM 0;
                
SetPlayerHealth(i0);
                
DmEventCountDown 60;
                
SetPlayerInterior(i0);
                
DmEventTimerVar SetTimer("DmEventT"1800000false);
                
KillTimer(Event1SecT);
            }
        }
        else  
// If players joined the event
        
{
            foreach(new 
Player)
            {
                
// code
            
}
        }
    }
    return 
1;

Your code should look something like this.

Again, if you're doing something, do it right from the start, not from the middle!

EDIT:

Mistake:
PHP код:
    AtriArmourPickup[0] = CreateDynamicPickup(124221734.8628,-1639.2264,20.2307, -118, -1100.0); 
    
AtriArmourPickup[0] = CreateDynamicPickup(124221708.9303,-1677.3439,27.2016, -118, -1100.0); 
Shouldn't it be...
PHP код:
    AtriArmourPickup[0] = CreateDynamicPickup(124221734.8628,-1639.2264,20.2307, -118, -1100.0); 
    
AtriArmourPickup[1] = CreateDynamicPickup(124221708.9303,-1677.3439,27.2016, -118, -1100.0); 
Reply
#6

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
Dude don't delete the thread even if u got the help i was also typing a longass reply there its rude...
also show these :
PHP код:
PlayersJoinedEvent && IsPlayerInEvent[i] == true 
where are u doing PlayersJoinedEvent++; and the IsPLayerInEvent[playerid] =true;
Oh, I'm really sorry. Won't happen again.
Reply
#7

Quote:
Originally Posted by Uvais
Посмотреть сообщение
AtriDmStartTime()

PHP код:
public DmEventT()
{
    
SendClientMessageToAll(0x00FFFFAA"[EVENT]: {FFFFFF}Atrium deathmatch event has started, type /join to take part!");
    
AtriHealthPickup[0] = CreateDynamicPickup(124021728.2104,-1668.2876,22.6094, -118, -1100.0);
    
AtriHealthPickup[1] = CreateDynamicPickup(124021701.4614,-1648.4786,20.2194, -118, -1100.0);
    
AtriArmourPickup[0] = CreateDynamicPickup(124221734.8628,-1639.2264,20.2307, -118, -1100.0);
    
AtriArmourPickup[0] = CreateDynamicPickup(124221708.9303,-1677.3439,27.2016, -118, -1100.0);
    
AtriAdrenalinePickup CreateDynamicPickup(124121721.5195,-1672.7142,20.2234, -118, -1100.0);
    
Event1SecT SetTimer("AtriDmStartTime"1000true);
    
KillTimer(DmEventTimerVar);
    
AtriDM 1;
    return 
1;

PHP код:
CMD:forcetevent(playeridparmas)
{
    if(
PInfo[playerid][Admin] < 3) return SendClientMessage(playeridRED,"[ERROR]: {FFFFFF}You do not have the privilleges to perform this command.");
    
DmEventT();
    return 
1;

I read what you said, I deleted that thread because it was a common mistake and i was just being stupid. Though I will rewrite my code sometime in the near future. I hope you could help me with this.
Uhm... show the /join command... make sure that you're doing what i said in my previous comment (PlayersJoined++ and IsPlayerInEvent=true)
Reply
#8

PHP код:
CMD:join(playeridparmas)
{
    if(
AtriDM == 0) return SendClientMessage(playerid0xFF0000AA"[EVENT]: {FFFFFF}No event started yet!");
    if(
IsPlayerInEvent[playerid] == true) return SendClientMessage(playerid0xFF0000AA"[EVENT]: {FFFFFF}You already joined the event be patience the event will start soon!");
    if(
AtriDM == 2) return SendClientMessage(playerid0xFF0000AA"[EVENT]: {FFFFFF}This event already begun you cant join now!");

    new 
Random random(sizeof(AtriSpawns)), string[128];
    
SetPlayerPos(playeridAtriSpawns[Random][0], AtriSpawns[Random][1], AtriSpawns[Random][2]);
    
SetPlayerFacingAngle(playeridAtriSpawns[Random][3]);
    
SetPlayerInterior(playerid18);
    
SetCameraBehindPlayer(playerid);
    
TogglePlayerControllable(playerid0);
    
SendClientMessage(playerid0x00FF00AA"[EVENT]: {FFFFFF}You have joined Atrium deathmatch event!");
    
format(stringsizeof(string), "[EVENT]: {FFFFFF}%s has joined the dm event, Type /join to enter it!"GetName(playerid));
    
SendClientMessageToAll(0x00FF00AAstring);
    
IsPlayerInEvent[playerid] = true;
    
PlayersJoinedEvent++;
    
ResetPlayerWeapons(playerid);
    
PlayerClass[playerid] = 0;
    
ChosenClass[playerid] = 0;
    
SetPlayerSkin(playerid294);
    
SetPlayerColor(playerid0xFFFFFFFF);
    
SetPlayerTeam(playeridTEAM_NONE);
    
GivePlayerWeapon(playerid31100);
    
GivePlayerWeapon(playerid2450);
    
GivePlayerWeapon(playerid2740);
    
GivePlayerWeapon(playerid3410);
    
GivePlayerWeapon(playerid161);
    return 
1;

Reply
#9

Take a look at my previous reply, your command looks fine.
Reply
#10

Quote:
Originally Posted by Logic_
Посмотреть сообщение
Take a look at my previous reply, your command looks fine.
Thanks, I have fixed that but the problem is still not resolved.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)