/gethere in dialog
#1

Hello, i need command /gethere in dialog..when someone writes Player id, it teleports player near, and opens back dialog for teleport, with exit button whn player wants to close the dialog.
I wrote the code, but unsucessfully
Reply
#2

Post your code.
Reply
#3

Why don't you just make a command for that? You'll need a variable to store the player id if you want to use dialogs
Reply
#4

I deleted the code, it doesnt worked..
I need command in dialog because when its an public event i need to teleport players, its better way than typing /gethere for an every player.
Reply
#5

It's better a command, you'll just need to press T, arrow up, delete the last number and change it with a new player id.
With dialogs you'll have to click on button "back", "Teleport" many times. Use a command mate


pawn Код:
CMD:gethere(playerid, params[])
{
         new teleportedid;
         if(sscanf(params, "u", teleportedid)) return SendClientMessage(playerid, -1, "/gethere [player id]");
         if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, -1, "That player isn't connected");
         new Float:x, Float:y, Float:z;
         GetPlayerPos(playerid, x, y, z);
         SetPlayerPos(teleportedid, x+1, y+1, z);
         return 1;
}
Reply
#6

You need to post the code so we know what you are trying, and that you are attempting to make something... Other wise the section would just be a code request section...


And any responses without the code, will all just be guesses.


Thanks Lucases for proving my point... You don't know if they are using zcmd, or SScanf, yet you use them...
Reply
#7

ZCMD, YCMD, IZCMD, Pawn.CMD have all the same sintax. About sscanf you're in right
Reply
#8

Here's what you're trying to do, not sure if it works because I can't test it, I literally wrote it in in the reply itself so there could be some error etc. because I can't really test it, also some parts might be displaced either way this should give you the idea or you can even use the whole code if it works as intended. Things you'll need to get it working are: mostly basic scripting knowledge, ZCMD(or IZCMD), sscanf and, well, I think that's it.


PHP код:
#define DIALOG_GETHERE 1337
CMD:gethere(playerid)
{
    if(
AdminLevel[playerid] > 1// replace it with whatever variable you use
    
{
        
ShowPlayerDialog(playeridDIALOG_GETHEREDIALOG_STYLE_INPUT"Player Teleport""Please enter the player's id or part of name that you want to teleport to yourself.""Teleport""Cancel");
    }
    else return 
SendClientMessage(playerid, -1"You are not authorized to use this command.");
    return 
1;
}
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
DIALOG_GETHERE:
        {
            if(
response)
            {
                new 
inputid;
                if(
sscanf(inputtext"u"inputid))
                {
                    
ShowPlayerDialog(playeridDIALOG_GETHEREDIALOG_STYLE_INPUT"Player Teleport""Please enter the player's id or part of name that you want to teleport to yourself.""Teleport""Cancel");
                    
SendClientMessage(playerid, -1"Invalid input.");
                    return 
1;
                }
                if(
inputid == playerid)
                {
                    
ShowPlayerDialog(playeridDIALOG_GETHEREDIALOG_STYLE_INPUT"Player Teleport""Please enter the player's id or part of name that you want to teleport to yourself.""Teleport""Cancel");
                    
SendClientMessage(playerid, -1"You can't teleport yourself to yourself.");
                    return 
1;
                }
                if(!
IsPlayerConnected(inputid))
                {
                    
ShowPlayerDialog(playeridDIALOG_GETHEREDIALOG_STYLE_INPUT"Player Teleport""Please enter the player's id or part of name that you want to teleport to yourself.""Teleport""Cancel");
                    
SendClientMessage(playerid, -1"This player is not connected.");
                    return 
1;
                }
                new 
Float:posxFloat:posyFloat:posz;
                
GetPlayerPos(playeridposxposyposz);
                
SetPlayerPos(inputidposxposy+1.5posz);
                new 
string[128], pname[MAX_PLAYER_NAME];
                
GetPlayerName(inputidpnameMAX_PLAYER_NAME);
                
format(stringsizeof(string), "You have teleported %s (ID: %i) to yourself."pnameinputid);
                
SendClientMessage(playerid, -1string);
                
GetPlayerName(playeridpnameMAX_PLAYER_NAME);
                
format(stringsizeof(string), "%s (ID: %i) have teleported you to himself."pnameplayerid);
                
SendClientMessage(inputid, -1string);
                
ShowPlayerDialog(playeridDIALOG_GETHEREDIALOG_STYLE_INPUT"Player Teleport""Please enter the player's id or part of name that you want to teleport to yourself.""Teleport""Cancel");
            }
            if(!
response)
            {
                
ShowPlayerDialog(playerid, -1DIALOG_STYLE_MSGBOX"BLAH""BLAH""BLAH""BLAH");
                
SendClientMessage(playerid, -1"Teleport dialog closed.");
            }
        }
    }

Reply
#9

Quote:
Originally Posted by Lucases
Посмотреть сообщение
ZCMD, YCMD, IZCMD, Pawn.CMD have all the same sintax. About sscanf you're in right
Doesn't mean he's using ANY of those...

I'm right about all of it, as you don't know if he's using any of the command processors... and you are simply guessing.

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
You need to post the code so we know what you are trying, and that you are attempting to make something... Other wise the section would just be a code request section...
You guys all need to stop simply pasting up code, praying for a rep, and ignoring what you're told.
Reply
#10

Quote:
Originally Posted by thefirestate
Посмотреть сообщение
Here's what you're trying to do, not sure if it works because I can't test it, I literally wrote it in in the reply itself so there could be some error etc. because I can't really test it, also some parts might be displaced either way this should give you the idea or you can even use the whole code if it works as intended. Things you'll need to get it working are: mostly basic scripting knowledge, ZCMD(or IZCMD), sscanf and, well, I think that's it.


PHP код:
#define DIALOG_GETHERE 1337
CMD:gethere(playerid)
{
    if(
AdminLevel[playerid] > 1// replace it with whatever variable you use
    
{
        
ShowPlayerDialog(playeridDIALOG_GETHEREDIALOG_STYLE_INPUT"Player Teleport""Please enter the player's id or part of name that you want to teleport to yourself.""Teleport""Cancel");
    }
    else return 
SendClientMessage(playerid, -1"You are not authorized to use this command.");
    return 
1;
}
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
DIALOG_GETHERE:
        {
            if(
response)
            {
                new 
inputid;
                if(
sscanf(inputtext"u"inputid))
                {
                    
ShowPlayerDialog(playeridDIALOG_GETHEREDIALOG_STYLE_INPUT"Player Teleport""Please enter the player's id or part of name that you want to teleport to yourself.""Teleport""Cancel");
                    
SendClientMessage(playerid, -1"Invalid input.");
                    return 
1;
                }
                if(
inputid == playerid)
                {
                    
ShowPlayerDialog(playeridDIALOG_GETHEREDIALOG_STYLE_INPUT"Player Teleport""Please enter the player's id or part of name that you want to teleport to yourself.""Teleport""Cancel");
                    
SendClientMessage(playerid, -1"You can't teleport yourself to yourself.");
                    return 
1;
                }
                if(!
IsPlayerConnected(inputid))
                {
                    
ShowPlayerDialog(playeridDIALOG_GETHEREDIALOG_STYLE_INPUT"Player Teleport""Please enter the player's id or part of name that you want to teleport to yourself.""Teleport""Cancel");
                    
SendClientMessage(playerid, -1"This player is not connected.");
                    return 
1;
                }
                new 
Float:posxFloat:posyFloat:posz;
                
GetPlayerPos(playeridposxposyposz);
                
SetPlayerPos(inputidposxposy+1.5posz);
                new 
string[128], pname[MAX_PLAYER_NAME];
                
GetPlayerName(inputidpnameMAX_PLAYER_NAME);
                
format(stringsizeof(string), "You have teleported %s (ID: %i) to yourself."pnameinputid);
                
SendClientMessage(playerid, -1string);
                
GetPlayerName(playeridpnameMAX_PLAYER_NAME);
                
format(stringsizeof(string), "%s (ID: %i) have teleported you to himself."pnameplayerid);
                
SendClientMessage(inputid, -1string);
                
ShowPlayerDialog(playeridDIALOG_GETHEREDIALOG_STYLE_INPUT"Player Teleport""Please enter the player's id or part of name that you want to teleport to yourself.""Teleport""Cancel");
            }
            if(!
response)
            {
                
ShowPlayerDialog(playerid, -1DIALOG_STYLE_MSGBOX"BLAH""BLAH""BLAH""BLAH");
                
SendClientMessage(playerid, -1"Teleport dialog closed.");
            }
        }
    }

Error: line 22266 : error 029: invalid expression, assumed zero
line: 22266 :
Код:
***switch(dialogid)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)