Timer problem
#1

When i write /lol after 5 seconds it should teleport me to some position i set.
Check this.
Code:
forward loltimer();            // at top


    if(!strcmp(cmdtext, "/lol", true))      // in  "public OnPlayerCommandText(playerid, cmdtext[])"
    {
            SetTimer("loltimer", 5000, false);
            return 1;
        }
           return 1;
        }


public loltimer()
{
            SetPlayerPos(playerid,2482.2227,-1646.2852,18.3521);
            return 1;
            }
I get error that "playerid" in "SetPlayerPos" line is not defined. I Dont Know what to do.
Reply
#2

Try this:

pawn Code:
new loltimer;                    // at the top
forward loltimer();            // at top


if(!strcmp(cmdtext, "/lol", true))      // in  "public OnPlayerCommandText(playerid, cmdtext[])"
{
   loltimer = SetTimer("loltimer", 5000, false);
    return 1;
 }

public loltimer()
{
  SetPlayerPos(playerid,2482.2227,-1646.2852,18.3521);
  return 1;
}
Reply
#3

pawn Code:
forward loltimer(playerid);

if(!strcmp(cmdtext,"/lol",true))
{
     SetTimerEx("loltimer", 5000, false,"i",playerid);
     return 1;
}


public loltimer(playerid)
{
SetPlayerPos(playerid,2482.2227,-1646.2852,18.3521);
return 1;
}
Reply
#4

OK, tnx, works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)