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(playerid, DIALOG_GETHERE, DIALOG_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(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_GETHERE:
{
if(response)
{
new inputid;
if(sscanf(inputtext, "u", inputid))
{
ShowPlayerDialog(playerid, DIALOG_GETHERE, DIALOG_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(playerid, DIALOG_GETHERE, DIALOG_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(playerid, DIALOG_GETHERE, DIALOG_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:posx, Float:posy, Float:posz;
GetPlayerPos(playerid, posx, posy, posz);
SetPlayerPos(inputid, posx, posy+1.5, posz);
new string[128], pname[MAX_PLAYER_NAME];
GetPlayerName(inputid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "You have teleported %s (ID: %i) to yourself.", pname, inputid);
SendClientMessage(playerid, -1, string);
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "%s (ID: %i) have teleported you to himself.", pname, playerid);
SendClientMessage(inputid, -1, string);
ShowPlayerDialog(playerid, DIALOG_GETHERE, DIALOG_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, -1, DIALOG_STYLE_MSGBOX, "BLAH", "BLAH", "BLAH", "BLAH");
SendClientMessage(playerid, -1, "Teleport dialog closed.");
}
}
}
}
|