/goto playerid -
Millionaire - 07.09.2011
Hello!
is it possible to a command /goto playerid ,in that normal players can do this cmd .First /enablegoto id then only a player can teleport to other player.Is it possible? if yes then plz help me

Thank you..
Re: /goto playerid -
=WoR=Varth - 07.09.2011
You mean player can only teleport to another player that do /enablegoto?
Re: /goto playerid -
Millionaire - 07.09.2011
yes it is
Re: /goto playerid -
Pghpunkid - 07.09.2011
You need a true or false value for each player. This can be done by the following array:
pawn Код:
new GoToEnabled[MAX_PLAYERS];
This basically is disabling it for all players, because its default value is 0.
Next you need a allow-goto command that would set that to 1. I suggest you do a toggle for 1 command.. meaning, if its 1, set it to 0 (disabling it) or if its 0, set it to 1. be sure to use an If Else statement for that, otherwise it might falsely set it back to 0, or 1 depending on the order you choose.
Lastly, you need a teleport command that checks if the target players GoToEnabled value is 1, and if they are spawned using GetPlayerState. if so, teleport them, if not, display a message how that person has not enabled their allow-goto ability.
Now be sure that OnPlayerConnect or OnPlayerDisconnect you set their value back to 0, so the new player can decide on their own if they want to or not.
Hope this helps, it contains all the mechanics. By default, every player will be disabled unless you set all 500 slots of that array to 1.
Re: /goto playerid -
Millionaire - 07.09.2011
can you give me the full code ?
Re: /goto playerid -
Jafet_Macario - 07.09.2011
PHP код:
new GoToEnabled[MAX_PLAYERS];
GoToEnabled[playerid] = 0; // OnPlayerConnect
YCMD:enablegoto(playerid, o[], help)
{
#pragma unused help
#pragma unused o
if(GoToEnabled[playerid] == 0)
{
GoToEnabled[playerid] = 1;
SendClientMessage(playerid, -1,"You have enabled the goto command");
}
else
{
GoToEnabled[playerid] = 0;
SendClientMessage(playerid, -1,"You have disabled the goto command");
}
return 1;
}
YCMD:goto(playerid, o[], help)
{
#pragma unused help
new pID;
if(sscanf(o,"u", pID)) return SendClientMessage(playerid, -1,"Syntax error.Correct usage: /goto [PlayerID/Name]");
if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1,"That player is not connected");
if(GoToEnabled[pID] == 0) return SendClientMessage(playerid, -1,"That player has disabled the goto command");
new Float:x, Float:y, Float:z;
GetPlayerPos(pID, x, y, z);
SetPlayerPos(playerid, x+1, y+1, z);
return 1;
}
Re: /goto playerid -
=WoR=Varth - 07.09.2011
pawn Код:
new bool:TP[MAX_PLAYERS];
CMD:enablegoto(playerid,params[])
{
TP[playerid] = true;
return 1;
}
CMD:goto(playerid,params[])
{
if(!IsPlayerConnected(strval(params))) return 0;
if(!TP[strval(params)]) return 0;
new Float:Pos[3];
GetPlayerPos(strval(params),Pos[0],Pos[1],Pos[2]);
SetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
return 1;
}
Re: /goto playerid -
Millionaire - 07.09.2011
ok guys ty
Re: /goto playerid -
Pghpunkid - 07.09.2011
Quote:
Originally Posted by Millionaire
ok guys ty 
|
I like varthshenons, however, if they enable it at class select menu, you will be able to teleport to them while they choose their skin.