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

[HELP] Errors! Run Command On Player death!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sarabveer
Veteran Member
Join Date: Feb 2014
Old 07-10-2014 , 10:34   [HELP] Errors! Run Command On Player death!
Reply With Quote #1

I'm trying to make a plugin to run a command on player death "sm_respawn". Synergy is stupid and gives people random respawn times. So this command spawns them really fast. I'm really new at this.

The Errors:
death.sp(14) : error 017: undefined symbol "OnPlayerDeath"
death.sp(18 ) : error 055: start of function body without function header

Code:
#include <sourcemod>
 
public Plugin:myinfo =
{
        name = "Run Command on Death",
        author = "Sarabveer",
        description = "Runs Command on Player Death",
        version = "1.0",
        url = "https://www.v33r.cf/"
};
 
public OnPluginStart()
{
        HookEvent("player_death", OnPlayerDeath);
}
 
public OnPlayerDeath
{
        ClientCommand(client, "sm_respawn")
}
__________________

Last edited by Sarabveer; 07-10-2014 at 10:35.
Sarabveer is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 07-10-2014 , 10:52   Re: [HELP] Errors! Run Command On Player death!
Reply With Quote #2

Please post the full code, so that others can examine it.
zmd94 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-10-2014 , 11:02   Re: [HELP] Errors! Run Command On Player death!
Reply With Quote #3

This is totally wrong.

PHP Code:
public OnPlayerDeath
{
        
ClientCommand(client"sm_respawn")

It should look something like this

PHP Code:
public OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
        new 
userid GetEventInt(event"userid");
        
ServerCommand("sm_respawn #%d"userid);

Note: I didn't actually test this.
Edit: Realized that ClientCommand was also wrong, so updated it to ServerCommand.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 07-10-2014 at 11:06.
Powerlord is offline
Sarabveer
Veteran Member
Join Date: Feb 2014
Old 07-10-2014 , 11:52   Re: [HELP] Errors! Run Command On Player death!
Reply With Quote #4

Quote:
Originally Posted by Powerlord View Post
This is totally wrong.

PHP Code:
public OnPlayerDeath
{
        
ClientCommand(client"sm_respawn")

It should look something like this

PHP Code:
public OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
        new 
userid GetEventInt(event"userid");
        
ServerCommand("sm_respawn #%d"userid);

Note: I didn't actually test this.
Edit: Realized that ClientCommand was also wrong, so updated it to ServerCommand.
sm_respawn has to be done by the client. Also, this is the complete code.
__________________

Last edited by Sarabveer; 07-10-2014 at 11:52.
Sarabveer is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-10-2014 , 12:01   Re: [HELP] Errors! Run Command On Player death!
Reply With Quote #5

I would have thought sm_respawn would be restricted, hence why the server is doing it using a standard targetting string, but if not, this was the original version I wrote:

PHP Code:
public OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
        new 
client GetClientOfUserId(GetEventInt(event"userid"));
        
ClientCommand(client"sm_respawn");

__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
DoPe^
Veteran Member
Join Date: Jul 2008
Location: Denmark / Copenhagen
Old 07-10-2014 , 12:01   Re: [HELP] Errors! Run Command On Player death!
Reply With Quote #6

...
__________________

Last edited by DoPe^; 07-10-2014 at 12:02.
DoPe^ is offline
DoPe^
Veteran Member
Join Date: Jul 2008
Location: Denmark / Copenhagen
Old 07-10-2014 , 12:02   Re: [HELP] Errors! Run Command On Player death!
Reply With Quote #7

Powerlord already responded :p
__________________

Last edited by DoPe^; 07-10-2014 at 12:02.
DoPe^ is offline
Sarabveer
Veteran Member
Join Date: Feb 2014
Old 07-10-2014 , 12:05   Re: [HELP] Errors! Run Command On Player death!
Reply With Quote #8

Quote:
Originally Posted by Powerlord View Post
I would have thought sm_respawn would be restricted, hence why the server is doing it using a standard targetting string, but if not, this was the original version I wrote:

PHP Code:
public OnPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
        new 
client GetClientOfUserId(GetEventInt(event"userid"));
        
ClientCommand(client"sm_respawn");

Thanks, your thing worked.
__________________

Last edited by Sarabveer; 07-10-2014 at 12:05.
Sarabveer 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 23:31.


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