Freezing problem
#1

Wow this post + my last one make me seem like a noob >.<

Anyway this post is about a timer etc. I made that doesn't want to work. The point of it is to check a players position every second, and if they are near a trap that has been laid by the other team, than they are frozen but, this is not working. Here is the code

Код:
forward MagTimer(playerid);


public MagTimer(playerid)
{
 	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(Xmag[i] != 255 && Ymag[i] != 255 && Zmag[i] != 255 && PlayerToPoint(2.0,i,Xmag[i],Ymag[i],Zmag[i]))
		{
			if (gTeam[playerid] == TEAM_SEAK)
		    {
				TogglePlayerControllable(playerid,0);
				Xmag[i] = 255;
				Ymag[i] = 255;
				Zmag[i] = 255;
				return 1;
			}
		}
	}
	return 0;
}


public OnPlayerSpawn(playerid)
{
    if (gTeam[playerid] == TEAM_SEAK)
	{
	  SetTimer("MagTimer",1000,1);
	  SetPlayerToTeamColor(playerid);
      return 1;
     }
     return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	new Float:x, Float:y, Float:z;
	if(strcmp(cmdtext,"/trap",true) ==0)
	{
		if (gTeam[playerid] == TEAM_SNEAK)
		{
	  	    if(Mag[playerid] == 0)
	  	    {
				Mag[playerid] = 1;
				GetPlayerPos(playerid,x,y,z);
	  		    Xmag[playerid] = x;
   			    Ymag[playerid] = y;
    		    Zmag[playerid] = z;
	  		    SetPlayerMapIcon(playerid,1,x,y,z,61,COLOR_YELLOW);
	  		    ApplyAnimation(playerid,"BOMBER","BOM_Plant",1,0,0,0,0,2000);
    			    CreateObject(2824,x,y,18.7,0,0,0);
	  		    SendClientMessage(playerid,COLOR_BLUE,"You have placed a magazine. It will distract anyone that walks by it. You have 1 mag remaining!");
				return 1;
	  	    }
Blah blah
Reply


Messages In This Thread
Freezing problem - by Ov3rl0rd - 11.09.2009, 05:05
Re: Freezing problem - by Ov3rl0rd - 11.09.2009, 07:40
Re: Freezing problem - by Gappy - 11.09.2009, 07:42
Re: Freezing problem - by Ov3rl0rd - 11.09.2009, 07:51
Re: Freezing problem - by Clavius - 11.09.2009, 08:11
Re: Freezing problem - by Ov3rl0rd - 11.09.2009, 08:14

Forum Jump:


Users browsing this thread: 1 Guest(s)