[HELP][$$$] I got plugin Problem!!! Need HELP MUCH!! pls!1!! will paid much key$! //topic
Hi all,
I getting crazy. This is the x-time i try to solve this issue without success. I have this problem for a long time, as I wrote MyJailbreak/Drunk event day plugin and used this code from [ANY] Curse v1.2.1 the world was shiny.
PHP Code:
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon) { if(g_cursed[client]) { if(g_cvar_x.BoolValue) { vel[1] = -vel[1]; // Will always equal to the opposite value, according to rules of arithmetic.
This snippet invert the player movement ('W'=back,'S'=foward,'A'=right,'D'=left).
In the beginning it works like charm, but later stopped it working without changes on plugin and my world getting dark.
The mysterious - the code snippet still works in original Curse plugin but not in my drunk plugin.
If the code is inside my drunk plugins it's like the plugin push a button permanently. So I walk move back/forwards.
tl;dr I copy/pasted 1:1 the code, but get different result in two plugin surroundings.
I just changed the client bool g_cursed[client] to a no client bool IsDrunk & renamed the Cvars g_cvar_y/x.
I even removed all checks (cvar&bool) in original curse & my drunk plugin. Again two different results. It's bewitched
Spoiler
PHP Code:
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon) { vel[1] = -vel[1]; // Will always equal to the opposite value, according to rules of arithmetic. if(buttons & IN_MOVELEFT) { // Fixes walking animations for CS:GO. buttons &= ~IN_MOVELEFT; buttons |= IN_MOVERIGHT; } else if(buttons & IN_MOVERIGHT) { buttons &= ~IN_MOVERIGHT; buttons |= IN_MOVELEFT; } vel[0] = -vel[0]; if(buttons & IN_FORWARD) { buttons &= ~IN_FORWARD; buttons |= IN_BACK; } else if(buttons & IN_BACK) { buttons &= ~IN_BACK; buttons |= IN_FORWARD; } return Plugin_Changed; }
//Info public Plugin myinfo = { name = "MyJailbreak - Drunk", author = "shanapu", description = "Event Day for Jailbreak Server", version = MYJB_VERSION, url = MYJB_URL_LINK };
//Start public void OnPluginStart() { // Translation LoadTranslations("MyJailbreak.Warden.phrases"); LoadTranslations("MyJailbreak.Drunk.phrases");
//Client Commands RegConsoleCmd("sm_setdrunk", Command_SetDrunk, "Allows the Admin or Warden to set drunk as next round"); RegConsoleCmd("sm_drunk", Command_VoteDrunk, "Allows players to vote for a drunk");
//ConVarChange for Strings public int OnSettingChanged(Handle convar, const char[] oldValue, const char[] newValue) { if (convar == gc_sOverlayStartPath) //Add overlay to download and precache table if changed { strcopy(g_sOverlayStartPath, sizeof(g_sOverlayStartPath), newValue); if (gc_bOverlays.BoolValue) PrecacheDecalAnyDownload(g_sOverlayStartPath); } else if (convar == gc_sSoundStartPath) //Add sound to download and precache table if changed { strcopy(g_sSoundStartPath, sizeof(g_sSoundStartPath), newValue); if (gc_bSounds.BoolValue) PrecacheSoundAnyDownload(g_sSoundStartPath); } else if (convar == gc_sAdminFlag) { strcopy(g_sAdminFlag, sizeof(g_sAdminFlag), newValue); } }
//Initialize Plugin public void OnConfigsExecuted() { //Find Convar Times g_iTruceTime = gc_iTruceTime.IntValue; g_iCoolDown = gc_iCooldownStart.IntValue + 1; g_iMaxRound = gc_iRounds.IntValue;
for (int i = 0; i < iCount; i++) { Format(sCommand, sizeof(sCommand), "sm_%s", sCommandsL[i]); if (GetCommandFlags(sCommand) == INVALID_FCVAR_FLAGS) //if command not already exist RegConsoleCmd(sCommand, Command_VoteDrunk, "Allows players to vote for a drunk"); }
for (int i = 0; i < iCount; i++) { Format(sCommand, sizeof(sCommand), "sm_%s", sCommandsL[i]); if (GetCommandFlags(sCommand) == INVALID_FCVAR_FLAGS) //if command not already exist RegConsoleCmd(sCommand, Command_SetDrunk, "Allows the Admin or Warden to set drunk as next round"); } }
//Admin & Warden set Event public Action Command_SetDrunk(int client, int args) { if (gc_bPlugin.BoolValue) //is plugin enabled? { if (client == 0) { StartNextRound(); if (MyJailbreak_ActiveLogging()) LogToFileEx(g_sEventsLogFile, "Event Drunk was started by groupvoting"); } else if (warden_iswarden(client)) //is player warden? { if (gc_bSetW.BoolValue) //is warden allowed to set? { char EventDay[64]; MyJailbreak_GetEventDayName(EventDay);
if (StrEqual(EventDay, "none", false)) //is an other event running or set? { if (g_iCoolDown == 0) //is event cooled down? { StartNextRound(); //prepare Event for next round if (MyJailbreak_ActiveLogging()) LogToFileEx(g_sEventsLogFile, "Event drunken was started by warden %L", client); } else CReplyToCommand(client, "%t %t", "drunk_tag" , "drunk_wait", g_iCoolDown); } else CReplyToCommand(client, "%t %t", "drunk_tag" , "drunk_progress" , EventDay); } else CReplyToCommand(client, "%t %t", "warden_tag" , "nocscope_setbywarden"); } else if (CheckVipFlag(client, g_sAdminFlag)) { if (gc_bSetA.BoolValue) //is admin allowed to set? { char EventDay[64]; MyJailbreak_GetEventDayName(EventDay);
if (StrEqual(EventDay, "none", false)) //is an other event running or set? { if ((g_iCoolDown == 0) || gc_bSetABypassCooldown.BoolValue) //is event cooled down? { StartNextRound(); //prepare Event for next round; if (MyJailbreak_ActiveLogging()) LogToFileEx(g_sEventsLogFile, "Event drunken was started by admin %L", client); } else CReplyToCommand(client, "%t %t", "drunk_tag" , "drunk_wait", g_iCoolDown); } else CReplyToCommand(client, "%t %t", "drunk_tag" , "drunk_progress" , EventDay); } else CReplyToCommand(client, "%t %t", "nocscope_tag" , "drunk_setbyadmin"); } else CReplyToCommand(client, "%t %t", "warden_tag" , "warden_notwarden"); } else CReplyToCommand(client, "%t %t", "drunk_tag" , "drunk_disabled"); return Plugin_Handled; }
//Voting for Event public Action Command_VoteDrunk(int client, int args) { char steamid[64]; GetClientAuthId(client, AuthId_Steam2, steamid, sizeof(steamid));
if (gc_bPlugin.BoolValue) //is plugin enabled? { if (gc_bVote.BoolValue) //is voting enabled? { char EventDay[64]; MyJailbreak_GetEventDayName(EventDay);
if (StrEqual(EventDay, "none", false)) //is an other event running or set? { if (g_iCoolDown == 0) //is event cooled down? { if (StrContains(g_sHasVoted, steamid, true) == -1) //has player already voted { int playercount = (GetClientCount(true) / 2); g_iVoteCount++; int Missing = playercount - g_iVoteCount + 1; Format(g_sHasVoted, sizeof(g_sHasVoted), "%s, %s", g_sHasVoted, steamid);
if (!StrEqual(EventDay, "none", false)) { g_iCoolDown = gc_iCooldownDay.IntValue + 1; } else if (g_iCoolDown > 0) g_iCoolDown--; } }
//Round End public void Event_RoundEnd(Event event, char[] name, bool dontBroadcast) { DrunkTimer = null; delete DrunkTimer; int winner = event.GetInt("winner");
if (IsDrunk) //if event was running this round { LoopClients(client) { if (IsClientInGame(client)) SetEntData(client, FindSendPropInfo("CBaseEntity", "m_CollisionGroup"), 0, 4, true); //disbale noblock KillDrunk(client); } delete DrunkTimer; delete BeaconTimer; delete TruceTimer; //kill start time if still running if (winner == 2) PrintCenterTextAll("%t", "drunk_twin_nc"); if (winner == 3) PrintCenterTextAll("%t", "drunk_ctwin_nc"); if (g_iRound == g_iMaxRound) //if this was the last round { //return to default start values IsDrunk = false; StartDrunk = false; g_iRound = 0; Format(g_sHasVoted, sizeof(g_sHasVoted), "");
g_iMPRoundTime.IntValue = g_iOldRoundTime; //return to original round time MyJailbreak_SetEventDayName("none"); //tell myjailbreak event is ended MyJailbreak_SetEventDayRunning(false);
public void Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast) { int client = GetClientOfUserId(event.GetInt("userid")); // Get the dead clients id
//Initialize Event public void OnMapStart() { //set default start values g_iVoteCount = 0; //how many player voted for the event g_iRound = 0; IsDrunk = false; StartDrunk = false;
//Precache Sound & Overlay if (gc_bSounds.BoolValue) PrecacheSoundAnyDownload(g_sSoundStartPath); if (gc_bOverlays.BoolValue) PrecacheDecalAnyDownload(g_sOverlayStartPath); }
//Map End public void OnMapEnd() { //return to default start values IsDrunk = false; StartDrunk = false; delete TruceTimer; //kill start time if still running delete DrunkTimer; //kill start time if still running g_iVoteCount = 0; g_iRound = 0; g_sHasVoted[0] = '\0'; }
//Listen for Last Lequest public int OnAvailableLR(int Announced) { if (IsDrunk && gc_bAllowLR.BoolValue && (g_iTsLR > g_iTerrorForLR.IntValue)) { LoopClients(client) { if (IsClientInGame(client)) SetEntData(client, FindSendPropInfo("CBaseEntity", "m_CollisionGroup"), 0, 4, true); //disbale noblock KillDrunk(client); StripAllPlayerWeapons(client); if (GetClientTeam(client) == CS_TEAM_CT) { FakeClientCommand(client, "sm_weapons"); } GivePlayerItem(client, "weapon_knife"); } delete DrunkTimer; delete BeaconTimer; delete TruceTimer; //kill start time if still running if (g_iRound == g_iMaxRound) //if this was the last round { //return to default start values IsDrunk = false; StartDrunk = false; g_iRound = 0; Format(g_sHasVoted, sizeof(g_sHasVoted), "");
g_iMPRoundTime.IntValue = g_iOldRoundTime; //return to original round time MyJailbreak_SetEventDayName("none"); //tell myjailbreak event is ended MyJailbreak_SetEventDayRunning(false);
MyJailbreak_SetEventDayPlanned(true); g_iOldRoundTime = g_iMPRoundTime.IntValue; //save original round time g_iMPRoundTime.IntValue = gc_iRoundTime.IntValue;//set event round time
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon) { if (IsDrunk) { if(gc_bInvertX.BoolValue) { vel[1] = -vel[1]; // Will always equal to the opposite value, according to rules of arithmetic.
//Switch WSAD /* public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon) { if (IsDrunk) { if (gc_bInvertX.BoolValue) { vel[1] = -vel[1]; //Will always equal to the opposite value, according to rules of arithmetic.
if (buttons & IN_MOVELEFT) //Fixes walking animations for CS:GO. { buttons &= ~IN_MOVELEFT; buttons |= IN_MOVERIGHT; } else if (buttons & IN_MOVERIGHT) { buttons &= ~IN_MOVERIGHT; buttons |= IN_MOVELEFT; } } if (gc_bInvertY.BoolValue) { vel[0] = -vel[0];
public Plugin myinfo = { name = "Curse", author = "Farbror Godis", description = "Allows admins to invert the movement of selected players.", version = kPluginVersion, url = "sm.alliedmods.net" };
public void OnPluginStart() { CreateConVar("sm_curse_version", kPluginVersion, "Current Curse version", FCVAR_NOTIFY|FCVAR_SPONLY); g_cvar_x = CreateConVar("sm_curse_invert_x", "1", "Invert movement on the x-axis (left & right)", FCVAR_NONE, true, 0.0, true, 1.0); g_cvar_y = CreateConVar("sm_curse_invert_y", "1", "Invert movement on the y-axis (forward & back)", FCVAR_NONE, true, 0.0, true, 1.0);
public void OnClientPutInServer(int client) { g_cursed[client] = false; }
public void OnClientDisconnect(int client) { g_cursed[client] = false; }
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon) { if(g_cursed[client]) { if(g_cvar_x.BoolValue) { vel[1] = -vel[1]; // Will always equal to the opposite value, according to rules of arithmetic.
public void AdminMenu_Curse(Handle topmenu, TopMenuAction action, TopMenuObject object_id, int param, char[] buffer, int maxlen) { // I'm going to break my "curly brace on same line" coding style here, or readability will suffer. if(action == TopMenuAction_DisplayOption) { Format(buffer, maxlen, "%T", "Curse player", param); } else if(action == TopMenuAction_SelectOption) { DisplayCurseMenu(param); } }
public int MenuHandler_Curse(Menu menu, MenuAction action, int param1, int param2) { if(action == MenuAction_Select) { char info[32]; menu.GetItem(param2, info, sizeof(info));
Like you see in the code comment, this block fixes walking animations for CS:GO.
But even without these block I don't get the desired effect on my plugin
Quote:
Originally Posted by 8guawong
maybe conflict with your other plugins?
of cause I disabled all other myjb plugins and only used drunk and/or curse on a blank server.
different results.
Must be a part of my drunk.sp but I can see it. May I'm just code blind for my own work. To lazy now to strip all function step by step to find the problem.
I assume you don't have the overlays of MyJailbreak when you test this.
Overlays works fine. no black screen if installed everything right. this is not the problem
This thread is about a problem with player movement modification. not about overlays
Quote:
my world getting dark.
This is just a mirror of my feelings about this problem.
Quote:
Do you hear sounds from game and do you hear your footsteps?
the game and plugin works fine. Its just about this one function at "OnPlayerRunCmd"
You should start by disabling every other custom plugin and seeing it it still happens. It might be the case that you have two plugins doing this at the same time and they are inverting each other. Like one does vel[1] = -vel[1] and then the other one does it again making it the same value it originally was.