AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   HELP Command goes moore than one Round (https://forums.alliedmods.net/showthread.php?t=260043)

Fireflasch7 03-18-2015 14:27

HELP Command goes moore than one Round
 
Hi,
I am really new at scripting but i have following script
and i want that the command goes only once per round but i dont get it i can do it moore than one Round pls help me
Best Wishes Goof
#pragma semicolon 1

#include <sourcemod>

new bool:g_bCmdUsed[MAXPLAYERS+1];

public
OnPluginStart()
{
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
RegConsoleCmd("sm_wdh", Command_Wdh);
}

public
OnClientConnected(client)
{
if (
g_bCmdUsed[client]) {
g_bCmdUsed[client] = false;
}
}

public
OnClientDisconnect(client)
{
if (
g_bCmdUsed[client]) {
g_bCmdUsed[client] = false;
}
}

public
Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
for (new
i = 1; i <= MaxClients; i++) {
if (
g_bCmdUsed[i]) {
g_bCmdUsed[i] = false;
}
}
}

public
Action:Command_Wdh(client, args)
{
if (!
client) {
ReplyToCommand(client, "You cannot run this command through the server console.");
return
Plugin_Handled;
}

if (
GetClientTeam(client) == 2) {
if (
g_bCmdUsed[client]) {
ReplyToCommand(client, "You can run this command once per round only.");
return
Plugin_Handled;
}
if (!
IsPlayerAlive(client)) {
ReplyToCommand(client, "Only alive terrorists can run this command.");
return
Plugin_Handled;
}
PrintToChatAll("%N möchte die Ansagen wiederholt haben", client);
g_bCmdUsed = true;
} else {
ReplyToCommand(client, "Only alive terrorists can run this command.");
}

return
Plugin_Handled;
}

Brrdy 03-18-2015 14:42

Re: HELP Command goes moore than one Round
 
Okay well for starters you double posted Im thinking one of your variables is invalid or just for some reason is being voided for some reason my computer is only loading half of your post but Ill take a peek later if it isn't resolved

Fireflasch7 03-19-2015 13:40

Re: HELP Command goes moore than one Round
 
Hi,
that would be very nice sorry for the double post


All times are GMT -4. The time now is 13:50.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.