Quote:
Originally Posted by Balimbanana
Use NULL_VECTOR for no change.
Edit: Or make another float with 0 0 0 to reset their velocity.
|
I am doing a plugin where player can save a CheckPoint and then with the menu, he can teleport to the saved checkpoint. But when teleporting it is teleporting me to the position I saved but inside the ground... And the noclip function is not saving on the file to set it to ON or OFF and isn't even giving noclip hability to the player.
PHP Code:
public void OnPluginStart()
{
RegConsoleCmd("sm_fj", Command_CheckPoint);
BuildPath(Path_SM, ncfile, sizeof(ncfile), "configs/SpirT/ncchoice.cfg");
g_enable = CreateConVar("sm_enablefj", "1", "Liga e desliga o plugin");
AutoExecConfig(true, "checkpoint.plugin", "SpirT");
}
public Action Command_CheckPoint(int client, int args)
{
int enabled = GetConVarInt(g_enable);
if(enabled == 0)
{
return Plugin_Handled;
}
else if(enabled == 1)
{
CreateCPMenu(client).Display(client, MENU_TIME_FOREVER);
return Plugin_Handled;
}
return Plugin_Handled;
}
public Menu CreateCPMenu(int client)
{
Menu menu = new Menu(cphandle, MENU_ACTIONS_ALL);
menu.SetTitle("[Cyg] FunJump Menu:");
menu.AddItem("1", "Save");
menu.AddItem("2", "Teleport");
KeyValues kv = new KeyValues("NoclipChoice");
kv.ImportFromFile(ncfile);
char steam[64];
if (GetClientAuthId(client, AuthId_Steam2, steam, sizeof(steam)))
{
if (kv.JumpToKey(steam, true))
{
char check[32];
kv.GetString("action", check, sizeof(check), "OFF");
if(StrEqual(check, "OFF"))
{
menu.AddItem("3", "Noclip [OFF]");
}
else if(StrEqual(check, "ON"))
{
menu.AddItem("3", "Noclip [ON]");
}
}
}
delete kv;
menu.ExitButton = true;
return menu;
}
public int cphandle(Menu menu, MenuAction action, int client, int item)
{
float position[3];
char choice[64];
menu.GetItem(item, choice, sizeof(choice));
if(action == MenuAction_Select)
{
if(StrEqual(choice, "1"))
{
//GetClientAbsOrigin(client, vec[0]);
//GetClientEyeAngles(client, vec[1]);
//if(StrEqual(choice, "2"))
//{
// TeleportEntity(client, vec[0], vec[1], NULL_VECTOR);
//}
GetEntPropVector(client, Prop_Send, "m_vecOrigin", position);
}
else if(StrEqual(choice, "2"))
{
TeleportEntity(client, position, NULL_VECTOR, NULL_VECTOR);
}
else if(StrEqual(choice, "3"))
{
KeyValues kv = new KeyValues("NoclipChoice");
kv.ImportFromFile(ncfile);
char steam[64];
if (GetClientAuthId(client, AuthId_Steam2, steam, sizeof(steam)))
{
if (kv.JumpToKey(steam, true))
{
char check[32];
kv.GetString("action", check, sizeof(check));
if (StrEqual(check, "ON"))
{
SetEntityMoveType(client, MOVETYPE_WALK);
kv.SetString("action", "OFF");
kv.ExportToFile(ncfile);
CreateCPMenu(client).Display(client, MENU_TIME_FOREVER);
}
else if (StrEqual(check, "OFF"))
{
SetEntityMoveType(client, MOVETYPE_NOCLIP);
kv.SetString("action", "ON");
kv.ExportToFile(ncfile);
CreateCPMenu(client).Display(client, MENU_TIME_FOREVER);
}
}
}
delete kv;
}
}
else if(action == MenuAction_End)
{
delete menu;
}
}
What do i need to change?
Best Regards and thanks for your help,
SpirT.
__________________