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

[L4D2] Handle Round Respawn requires 3rd argument


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
_Cri_
New Member
Join Date: May 2019
Old 05-14-2019 , 05:19   [L4D2] Handle Round Respawn requires 3rd argument
Reply With Quote #1

Like the title says every time I do !buyrespawn in chat it works if I'm alive and if I dont have points but for some reasons when I do it when I'm dead it sends me the points message, the cost message but when it reaches the "SDKCall(hRoundRespawn, client);" line it doesn't work, and it obviously doesn't remove the points.
I'm asking help because I tried a messier script with other stuff and it respawns without a 3rd parameter
This is the error:


The plugin uses the [L4D2] Points System v1.6.9 Beta R1 natives

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

#include <ps_natives>

static Handle:hRoundRespawn INVALID_HANDLE;

public 
Plugin myinfo =
{
    
name "Player Utils",
    
author "Cris16228",
    
description "Utils for all and Admins",
    
version "1.0",
    
url "N/A"
};
 
public 
void OnPluginStart()
{
    
CreateConVar("cost_respawn","120","How many points the respawn cost."_,true,0.0);
    
RegConsoleCmd("sm_buyrespawn"BuyRespawn);
    
hRoundRespawn EndPrepSDKCall();
    
LogMessage("Plugin Loaded");
}
public 
Action:BuyRespawn(clientargs)
{
    if(
IsPlayerAlive(client))
    {
        
ReplyToCommand(client"[PU] You must be dead to buy the respawn!");
        return 
Plugin_Continue;
    }
    
int icost GetConVarInt(FindConVar("cost_respawn"));
    if(!
IsPlayerAlive(client) && PS_GetPoints(client) >= icost && IsClientInGame(client))
    {
        
ReplyToCommand(client"[PU] You currently have %d points",PS_GetPoints(client));
        
ReplyToCommand(client"[PU] The respawn cost is %d points",icost);
        
SDKCall(hRoundRespawnclient);
        
PS_SetBought(client"revive");
        
PS_SetPoints(clientPS_GetPoints(client) - icost);
    }
    else
    {
        
PrintToChat(client"[PU] Not Enough Points");
    }
    return 
Plugin_Continue;

_Cri_ is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 05-14-2019 , 05:23   Re: [L4D2] Handle Round Respawn requires 3rd argument
Reply With Quote #2

You posted in the wrong section.

You have "hRoundRespawn = EndPrepSDKCall();" but missing the whole PrepSDKCall part.
__________________
Silvers is offline
_Cri_
New Member
Join Date: May 2019
Old 05-14-2019 , 05:49   Re: [L4D2] Handle Round Respawn requires 3rd argument
Reply With Quote #3

Quote:
Originally Posted by Silvers View Post
You posted in the wrong section.

You have "hRoundRespawn = EndPrepSDKCall();" but missing the whole PrepSDKCall part.
Wow.. I didn't see the "Sourcemod" section. Sorry
_Cri_ is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 05-14-2019 , 05:55   Re: [L4D2] Handle Round Respawn requires 3rd argument
Reply With Quote #4

I guess a mod will move.

See this plugin for how respawning works: https://forums.alliedmods.net/showthread.php?p=862618
__________________
Silvers is offline
_Cri_
New Member
Join Date: May 2019
Old 05-14-2019 , 06:40   Re: [L4D2] Handle Round Respawn requires 3rd argument
Reply With Quote #5

Quote:
Originally Posted by Silvers View Post
I guess a mod will move.

See this plugin for how respawning works: https://forums.alliedmods.net/showthread.php?p=862618
Thanks

Edit: It works but testing it I saw if I die twice (at least) and I buy one respawn and I use the defib function of Admin System I respawn where I'm dead the first time, is it normal?

Broadcast part not tested
PHP Code:
#include <sourcemod>
#include <sdktools>

#include <ps_natives>

static Handle:hRoundRespawn INVALID_HANDLE;
static 
Handle:hGameConf INVALID_HANDLE;
new 
pointstimer;
new 
pointsremindtimer;

public 
Plugin myinfo =
{
    
name "Player Utils",
    
author "Cris16228",
    
description "Utils for all and Admins",
    
version "1.0",
    
url "N/A"
};
 
public 
void OnPluginStart()
{
    
CreateConVar("cost_respawn","120","How many points the respawn cost."_,true,0.0);
    
CreateConVar("points_advertising_ticks","60","How many seconds before the reminder is displayed."_,true,5.0);
    
CreateConVar("respawn_advertising_ticks","60","How many seconds before the reminder is displayed."_,true,5.0);
    
    
pointsremindtimer 1;
    
RegConsoleCmd("sm_buyrespawn"BuyRespawn);
    
hGameConf LoadGameConfigFile("l4drespawn");
    if (
hGameConf != INVALID_HANDLE)
    {
        
StartPrepSDKCall(SDKCall_Player);
        
PrepSDKCall_SetFromConf(hGameConfSDKConf_Signature"RoundRespawn");
        
hRoundRespawn EndPrepSDKCall();
        if (
hRoundRespawn == INVALID_HANDLESetFailState("L4D_SM_Respawn: RoundRespawn Signature broken");
    }
    else
    {
        
SetFailState("could not find gamedata file at addons/sourcemod/gamedata/l4drespawn.txt , you FAILED AT INSTALLING");
    }
    
LogMessage("Plugin Loaded");
}
public 
Action:BuyRespawn(clientargs)
{
    if(
IsPlayerAlive(client))
    {
        
ReplyToCommand(client"[PU] You must be dead to buy the respawn!");
        return 
Plugin_Continue;
    }
    
int icost GetConVarInt(FindConVar("cost_respawn"));
    if(!
IsPlayerAlive(client) && PS_GetPoints(client) >= icost && IsClientInGame(client))
    {
        
ReplyToCommand(client"[PU] You currently have %d points",PS_GetPoints(client));
        
ReplyToCommand(client"[PU] The respawn cost is %d points",icost);
        
SDKCall(hRoundRespawnclient);
        
PS_SetBought(client"revive");
        
PS_SetPoints(clientPS_GetPoints(client) - icost);
    }
    else
    {
        
PrintToChat(client"[PU] Not Enough Points");
    }
    return 
Plugin_Continue;
}

public 
Action:TimerUpdate(Handle:timer)
{
    
pointstimer += 1;
    if (
pointstimer >= GetConVarInt(points_advertising_ticks) * pointsremindtimer)
    {
        
PrintToChatAll("[PU] Type !buy to buy items in shop.");
        
LogMessage("Broadcast executed with success");
    }
    else if (
pointstimer >= GetConVarInt(respawn_advertising_ticks) * pointsremindtimer)
    {
        
PrintToChatAll("[PU] If you're dead type !buyrespawn to respawn at the beginning of the buy items in shop.");
        
LogMessage("Broadcast executed with success");
    }


Last edited by _Cri_; 05-14-2019 at 07:21.
_Cri_ 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 19:29.


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