public Help [ Urgent ]
#1

Hi all i'm trying it so when if(IsPlayerInRangeOfPoint(i,177.4720,1894.8317,114 9.6217))
It freezes them for 3 seconds after that 3 seconds it unfreezes them... What am I doing wronge and what do I have to do to make this work ?


Код:
forward IsAtDeMorgan()
Код:
public IsAtDeMorgan()
{
	for(new i=0; i<MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if(IsPlayerInRangeOfPoint(i,177.4720,1894.8317,1149.6217))
			{
				GameTextForPlayer(i, "~g~ Loading Objects...", 5000, 6);
				PlayerPlaySound(i, 1145, 0.0, 0.0, 0.0);
				SendClientMessage(i,COLOR_GREY, " Welcome to Fort DeMorgan");
				TogglePlayerControllable(i, 0);
				SetTimer("IsAtDeMorgan",2000,false);
				return 1;
			}
		}
	}
}
Reply
#2

I assume the intent of the code is to freeze players for 3 seconds after teleporting to Fort DeMorgan, so that it gives objects a time to load? If I assume correctly, then I would suggest turning the function into something like "DeMorganTeleport(playerid)", and include the teleport command inside it (along with the freezing command). This way, you wouldn't need to mess about with the IsPlayerInRangeOfPoint function.

Let me know if this is what you want and I'll help you out. If I've completely misunderstood, just ignore me
Reply
#3

C:\Documents and Settings\Owner\Desktop\SA-MP Optical\gamemodes\OGv66.pwn(3860 : warning 235: public function lacks forward declaration (symbol "DeMorganFreeze")
C:\Documents and Settings\Owner\Desktop\SA-MP Optical\gamemodes\OGv66.pwn(38610) : error 017: undefined symbol "SetPlayerControllable"
C:\Documents and Settings\Owner\Desktop\SA-MP Optical\gamemodes\OGv66.pwn(38611) : error 017: undefined symbol "i"
C:\Documents and Settings\Owner\Desktop\SA-MP Optical\gamemodes\OGv66.pwn(38612) : error 017: undefined symbol "i"
C:\Documents and Settings\Owner\Desktop\SA-MP Optical\gamemodes\OGv66.pwn(38613) : error 017: undefined symbol "i"
C:\Documents and Settings\Owner\Desktop\SA-MP Optical\gamemodes\OGv66.pwn(38622) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Owner\Desktop\SA-MP Optical\gamemodes\OGv66.pwn(38631) : warning 209: function "IsAtDeMorgan" should return a value
C:\Documents and Settings\Owner\Desktop\SA-MP Optical\gamemodes\OGv66.pwn(46750) : warning 203: symbol is never used: "PlayerPos"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#4

Well I got ignored, but I have assumed that people on your server would get to Fort DeMorgan by using a tele command such as "/demorgan". Here is a solution if this is the case:

pawn Код:
forward UnfreezePlayer(playerid); //PUT AT THE TOP OF YOUR CODE

public UnfreezePlayer(playerid)
{
    TogglePlayerControllable(playerid, 1);
    return 1;
}

stock DeMorganTeleport(playerid)
{
    SetPlayerPos(playerid, 177.4720,1894.8317,1149.6217);
    GameTextForPlayer(playerid, "~g~ Loading Objects...", 5000, 6);
    PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
    SendClientMessage(playerid,COLOR_GREY, " Welcome to Fort DeMorgan");
    TogglePlayerControllable(playerid, 0);
    SetTimerEx("UnfreezePlayer",3000,false,"i",playerid);
    return 1;
}
As an example, this is how you would perform the teleport if you are using strcmp:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/demorgan", true, 9)) {
        DeMorganTeleport(playerid);
        return 1;
    }

    return 1;
}
Hope this helps.
Reply
#5

You forgot to forward it:
pawn Код:
forward IsAtDeMorgan();
Also you forgot the semicolon.

"SetPlayerControllable" doesn't exists, it's TogglePlayerControllable.

To fix the error 017, use this:
pawn Код:
public DeMorganFreeze()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    SetPlayerControllable(i,true);
    GameTextForPlayer(i, "~g~ Loading Objects...", 5000, 6);
    PlayerPlaySound(i, 1145, 0.0, 0.0, 0.0);
    SendClientMessage(i,COLOR_GREY, " Welcome to Fort DeMorgan");
  }
  return 1;
}
Also if(IsPlayerInRangeOfPoint(i,177.4720,1894.8317,114 9.6217)) is wrong, it should have a range, I recommend you to use the wiki: https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint

And I don't know how to fix the warning 203, you may try to remove the "PlayerPos" thing, since is never used.
Reply
#6

Compiles fine with no errors or warnings but when I get to that coordinate dosnt do anything

Код:
public DeMorganFreeze()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            TogglePlayerControllable(i, 1);
            GameTextForPlayer(i, "~g~ Loading Objects...", 5000, 6);
            PlayerPlaySound(i, 1145, 0.0, 0.0, 0.0);
            SendClientMessage(i,COLOR_GREY, " Welcome to Fort DeMorgan");
            return 1;
        }
    }
    return 1;
}
public IsAtDeMorgan()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInRangeOfPoint(i,5.0, 177.4720,1894.8317,1149.6217))
            {
                TogglePlayerControllable(i, 0);
                SetTimer("DeMorganFreeze",2 * 1000,false);

                return 1;
            }
        }
    }
    return 1;
}
?
Reply
#7

Add a timer to the IsAtDeMorgan function.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)