Want to setplayercheckpoint in a command ... how ? -
Bearfist - 01.05.2009
I want to set a checkpoint if the types the command ..
but I don't know how...
Re: Want to setplayercheckpoint in a command ... how ? -
afei - 01.05.2009
Uh do i think to easy now or.. do you just mean
Код:
dcmd_mycommand( playerid, text[] )
{
SetPlayerCheckpoint(playerid, x, y, z );
#pragma unused text
return 1;
}
Re: Want to setplayercheckpoint in a command ... how ? -
shitbird - 01.05.2009
Quote:
|
Originally Posted by afei™
Uh do i think to easy now or.. do you just mean
dcmd_mycommand( playerid, text[] )
{
SetPlayerCheckpoint(playerid, x, y, z );
#pragma unused text
return 1;
}
|
Question;
Shouldn't it be dcmd_mycommand(playerid, params)?
Re: Want to setplayercheckpoint in a command ... how ? -
afei - 01.05.2009
Doesnt matter how you name it
Код:
dcmd_mycommand( playerid, afei[] )
Re: Want to setplayercheckpoint in a command ... how ? -
Bearfist - 01.05.2009
yes and how to add a function which occurs when the player enters the checkpoint =)
But thanks for that little but helpful post

*happy*
Re: Want to setplayercheckpoint in a command ... how ? -
afei - 01.05.2009
You dont have to add such a function. There's already one.
Код:
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
Re: Want to setplayercheckpoint in a command ... how ? -
MenaceX^ - 01.05.2009
Quote:
|
Originally Posted by afei™
You dont have to add such a function. There's already one.
Код:
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
|
He's asking how to make a checkpoint in a command, not how to do something when a player enters a checkpoint.
pawn Код:
new
cmd[128];
if(!strcmp(cmd,"/checkpoint",true))
{
SetPlayerCheckpoint(playerid,x,y,z);
SendClientMessage(playerid,color,"Checkpoint created.");
return 1;
}
Re: Want to setplayercheckpoint in a command ... how ? -
afei - 01.05.2009
Quote:
|
Originally Posted by MenaceX^
Quote:
|
Originally Posted by afei™
You dont have to add such a function. There's already one.
Код:
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
|
He's asking how to make a checkpoint in a command, not how to do something when a player enters a checkpoint.
pawn Код:
new cmd[128]; if(!strcmp(cmd,"/checkpoint",true)) { SetPlayerCheckpoint(playerid,x,y,z); SendClientMessage(playerid,color,"Checkpoint created."); return 1; }
|
You should scroll up before posting
Quote:
|
Originally Posted by afei™
Uh do i think to easy now or.. do you just mean
Код:
dcmd_mycommand( playerid, text[] )
{
SetPlayerCheckpoint(playerid, x, y, z );
#pragma unused text
return 1;
}
|
Re: Want to setplayercheckpoint in a command ... how ? -
Bearfist - 01.05.2009
Yes but what to do with more functions ...
then onplayerentercheckpoint occurs only in one way and for All funtions which sets
a checkpoint ..
Or have i do it like this ?
Код:
if(strcmp("/mycommand",cmdtext,true) == 0)
{
SetPlayerCheckpoint(playerid,bla,bla,bla);
Whatelse[playerid] = 1;
SendClientMessage(playerid,COLOR_BLA,"GoGoGo XD!");
return 1;
}
OnPlayerEnterCheckpoint(playerid)
{
if(Whatelse[playerid] == 1)
{
DisablePlayerCheckpoint(playerid);
}
else
{
}
}
Re: Want to setplayercheckpoint in a command ... how ? -
afei - 01.05.2009
Quote:
|
Originally Posted by Bearfist
Yes but what to do with more functions ...
then onplayerentercheckpoint occurs only in one way and for All funtions which sets
a checkpoint ..
Or have i do it like this ?
Код:
if(strcmp("/mycommand",cmdtext,true) == 0)
{
SetPlayerCheckpoint(playerid,bla,bla,bla);
Whatelse[playerid] = 1;
SendClientMessage(playerid,COLOR_BLA,"GoGoGo XD!");
return 1;
}
OnPlayerEnterCheckpoint(playerid)
{
if(Whatelse[playerid] == 1)
{
DisablePlayerCheckpoint(playerid);
}
else
{
}
}
|
Yea you can. In your code it would only disable the checkpoint when it has been created via /mycommand. EDIT:Unless you use "Whatelse" in an other command as well.