Raised This Month: $51 Target: $400
 12% 

KILL LIMIT


Post New Thread Reply   
 
Thread Tools Display Modes
Alex.
SourceMod Donor
Join Date: Sep 2010
Location: England
Old 09-10-2010 , 03:15   Re: KILL LIMIT
Reply With Quote #21

Did you check the log? There is no set time limit between the PrintToChatAll and the ForceLevelChange, so it might happen so quickly you don't see the message.
Alex. is offline
willrock2700
Junior Member
Join Date: Sep 2010
Old 09-10-2010 , 05:53   Re: KILL LIMIT
Reply With Quote #22

i checked the logs no errors. but the map straight away changes on 101 kills and doesnt show any win messages
willrock2700 is offline
Alex.
SourceMod Donor
Join Date: Sep 2010
Location: England
Old 09-10-2010 , 10:52   Re: KILL LIMIT
Reply With Quote #23

I meant check the chat log in your developer console, not error log. The force level change and message happen so close together I doubt anyone would notice.
Alex. is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 09-10-2010 , 11:25   Re: KILL LIMIT
Reply With Quote #24

@ Alex, if you're still trying to fix this for him, why not schedule a 10 second timer after 100 kills have been reached and at the end of that timer, change the map? You could issue your messages, freeze the teams / give them god mode, etc, and it'll give players time to see who won.
__________________
thetwistedpanda is offline
Alex.
SourceMod Donor
Join Date: Sep 2010
Location: England
Old 09-10-2010 , 11:41   Re: KILL LIMIT
Reply With Quote #25

I was trying to, but I kept getting compiler errors with CreateTimer(). Maybe I'm using wrong or something but as far as I can tell from the API page, you use the function and it will call the second argument when the timer finishes.
PHP Code:
CreateTimer(10.0ForceChangeLevel(NextMapIsmapChangeReason)) 
Alex. is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 09-10-2010 , 11:48   Re: KILL LIMIT
Reply With Quote #26

PHP Code:
//10 Seconds, Function to be called, Pass reason, Kill the timer on map change
CreateTimer(10.0DelayedMapChangemapChangeReasonTIMER_FLAG_NO_MAPCHANGE);

//Timer function, Timer, Reason for changing
public Action:DelayedMapChange(Handle:timerany:reason)
{
    
ForceChangeLevel(NextMapIsreason)

__________________
thetwistedpanda is offline
Alex.
SourceMod Donor
Join Date: Sep 2010
Location: England
Old 09-10-2010 , 11:54   Re: KILL LIMIT
Reply With Quote #27

Thanks, but I get this from the compiler:
Quote:
/groups/sourcemod/upload_tmp/textFiboJq.sp(31) : error 035: argument type mismatch (argument 3)
/groups/sourcemod/upload_tmp/textFiboJq.sp(37) : error 017: undefined symbol "NextMapIs"
PHP Code:
#include <sourcemod>
#include <sdktools>

public Plugin:myinfo 
{
    
name "Kill Limit",
    
author "Alex",
    
description ="If a client reaches 100 kills, the map is moved on to the next one.",
    
version "0.3",
    
url ""
}

public 
OnPluginStart()
{
    
HookEvent("player_death"APlayerHasDied);
}

public 
APlayerHasDied(Handle:event, const String:name[], bool:dontBroadcast){
    new 
attackerId GetEventInt(event"attacker");
    new 
attackerClient GetClientOfUserId(attackerId);
    new 
String:NextMapIs[100];
    
GetNextMap(NextMapIs100);
    
    if(
GetClientFrags(attackerClient) == 100){
        
PrintToChatAll("%N is the winner with 100 kills."attackerClient);
        
        new 
String:mapChangeReason[100];
        
Format(mapChangeReason100"%N has reached 100 kills. Moving on to the next map."attackerClient);
        
//Thanks to thetwistedpanda for this next bit and the DelayedMapChange function.
        //10 Seconds, Function to be called, Pass reason, Kill the timer on map change
        
CreateTimer(10.0DelayedMapChangemapChangeReasonTIMER_FLAG_NO_MAPCHANGE);
    }
}

public 
Action:DelayedMapChange(Handle:timerany:reason)
{
    
ForceChangeLevel(NextMapIsreason)

Alex. is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 09-10-2010 , 12:04   Re: KILL LIMIT
Reply With Quote #28

Try this:
PHP Code:
#include <sourcemod>
#include <sdktools>

new String:storeNextMap[100];
new 
String:storeMapReason[100];
new 
storeMapWinner;

public 
Plugin:myinfo 
{
    
name "Kill Limit",
    
author "Alex",
    
description ="If a client reaches 100 kills, the map is moved on to the next one.",
    
version "0.3",
    
url ""
}

public 
OnPluginStart()
{
    
HookEvent("player_death"APlayerHasDied);
}

public 
APlayerHasDied(Handle:event, const String:name[], bool:dontBroadcast){
    new 
attackerId GetEventInt(event"attacker");
    new 
attackerClient GetClientOfUserId(attackerId);
    if(
GetClientFrags(attackerClient) >= 100){
        
storeMapWinner attackerId;
        
GetNextMap(storeNextMapsizeof(storeNextMap));

        
PrintToChatAll("%N is the winner with 100 kills."attackerClient);
        
CreateTimer(10.0DelayedMapChange_TIMER_FLAG_NO_MAPCHANGE);
    }
}

public 
Action:DelayedMapChange(Handle:timer)
{
    new 
attackerClient GetClientOfUserId(storeMapWinner);
    if(
attackerClient && IsClientInGame(attackerClient))
        
Format(storeMapReasonsizeof(storeMapReason), "%N has reached 100 kills. Moving on to the next map."storeMapWinner);
    else
        
Format(storeMapReasonsizeof(storeMapReason), "A player has reached 100 kills. Moving on to the next map.");
        
    
ForceChangeLevel(storeNextMapstoreMapReason);

__________________
thetwistedpanda is offline
willrock2700
Junior Member
Join Date: Sep 2010
Old 09-10-2010 , 14:34   Re: KILL LIMIT
Reply With Quote #29

L 09/10/2010 - 01:03:58: [SM] Native "GetClientFrags" reported: Client index 59 is invalid
L 09/10/2010 - 01:03:58: [SM] Displaying call stack trace for plugin "kill.smx":
L 09/10/2010 - 01:03:58: [SM] [0] Line 23, /groups/sourcemod/upload_tmp/textngZfkl.sp::APlayerHasDied()

L 09/11/2010 - 04:28:59: [SM] [0] Line 38, /groups/sourcemod/upload_tmp/textaVGMYL.sp:elayedMapChange()
L 09/11/2010 - 04:29:01: [SM] Native "Format" reported: Client index 269 is invalid
L 09/11/2010 - 04:29:01: [SM] Displaying call stack trace for plugin "lol.smx":


i quickly called the plugin "kill"/lol
willrock2700 is offline
willrock2700
Junior Member
Join Date: Sep 2010
Old 09-10-2010 , 14:35   Re: KILL LIMIT
Reply With Quote #30

This plugin so far makes a message saying who the winner it when 101kills have been reached and the map does not change
willrock2700 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:38.


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