SA-MP Forums Archive
[HELP]Teleport System - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP]Teleport System (/showthread.php?tid=471605)



[HELP]Teleport System - donhu789 - 24.10.2013

pawn Код:
CMD:teleon(playerid,params[])
{
   if(tele[playerid]==1)
   return SendClientMessage(playerid, red, "You've already enabled tele command.Use /teleoff");
   tele[playerid]=1;
   SendClientMessage(playerid, 0xFF0000, "You've enabled tele command.Note that others can teleport to you.");
   return 1;
}

CMD:teleoff(playerid,params[])
{
   if(tele[playerid]==0)
   return SendClientMessage(playerid, red, "Your tele command is already OFF.Use /teleon to enable.");
   tele[playerid]=0;
   SendClientMessage(playerid, red, "Your tele command has been turned off.");
   return 1;
}
I want to make both that in 1 command is that possible ? /tele and is will enable/disable the teleport is that possible ?
-Help Rep rep REP+++


Re: [HELP]Teleport System - SilentSoul - 24.10.2013

You want to disable player can use teleport to another player ? or you want to disable players to tp to him ? sorry i can't understand what exactly you want


Re: [HELP]Teleport System - DobbysGamertag - 24.10.2013

Like this?

pawn Код:
CMD:tele(playerid,params[])
{
    if(tele[playerid]==0)
    {
        tele[playerid]=1;
        SendClientMessage(playerid,-1,"Teleporting on");
    }
    else
    {
        tele[playerid]=0;
        SendClientMessage(playerid,-1,"Teleporting off");
    }
    return 1;
}



Re: [HELP]Teleport System - donhu789 - 24.10.2013

return SendClientMessage(playerid, red, "Your tele command is already OFF.Use /teleon to enable."); and what about this ?


Re: [HELP]Teleport System - SilentSoul - 24.10.2013

pawn Код:
CMD:tele(playerid, params[])
{
    ShowPlayerDialog(playerid,2332,DIALOG_STYLE_LIST,"Choose your option","Teleport On\nTeleport Off","ok","cancel");
    return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 2332)
    {
        if(response)
        {
            if(listitem == 0)
            {
                tele[playerid]=1;
                SendClientMessage(playerid, 0xFF0000, "You've enabled tele command.Note that others can teleport to you.");
                return 1;
            }
            if(listitem == 1)
            {
                tele[playerid]=0;
                SendClientMessage(playerid, red, "Your tele command has been turned off.");
                return 1;
            }
    return 1;
}
Also don't forget to define
pawn Код:
new tele[MAX_PLAYERS];