Raised This Month: $ Target: $400
 0% 

[TF2] MVP help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Marley
Junior Member
Join Date: Oct 2008
Old 12-03-2008 , 15:01   [TF2] MVP help
Reply With Quote #1

I can currently coding a plugin that will give you exp for certain actions.

One of the main actions I am looking at is MVP.

I am looking to convert the teamplay_win_panel player_#_points to a float value.

Any advice on how to do this?

Code:
public OnPluginStart()
{
    HookEvent("teamplay_win_panel", hookMVP1, EventHookMode_Post)
    
    }
public Action:hookMVP1(Handle:event, const String:name[], bool:dontBroadcast)
{
        new MVP1 = GetEventInt(event, "player_1")
        new MVP1P = GetEventInt(event, "player_1_points")
        new id =  GetClientOfUserId(MVP1)
        
        new Float:exp15 = 15.0;
        new Float:points1 =
Thats what I have so far, any advice will be greatly appreciated.
Marley is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 12-03-2008 , 15:17   Re: [TF2] MVP help
Reply With Quote #2

native Float:float(value);

Just replace 'value' with the integer to convert it into a float. Also, I might suggest just for readability sake doing something like...

Code:
new MVP1 = GetClientOfUserId(GetEventInt(event, "player_1"));
CrimsonGT is offline
Marley
Junior Member
Join Date: Oct 2008
Old 12-03-2008 , 15:19   Re: [TF2] MVP help
Reply With Quote #3

Ok thanks, and Cheers for that modification to the code
Marley is offline
Marley
Junior Member
Join Date: Oct 2008
Old 12-03-2008 , 16:31   Re: [TF2] MVP help
Reply With Quote #4

Need some help.

Code:
{
    HookEvent("teamplay_win_panel", hookMVP1, EventHookMode_Post)
    
    }
public Action:hookMVP1(Handle:event, const String:name[], bool:dontBroadcast)
{
        new MVP1 = GetEventInt(event, "player_1")
        new MVP1P = GetEventInt(event, "player_1_points")
        new id =  GetClientOfUserId(MVP1)
        
        new Float:exp15 = 15.0;
        native Points1:float(MVP1P);
        native Float:Total1(Float:Points1, Float:exp15);
        
            PrintToChat(id, "\x01\x03[\x04Test\x03] \x04Awarded %f Experience for being MVP 1", Total1)
    }
That gives me these errors, any idea on how to fix them?

Code:
/home/groups/sourcemod/upload_tmp/textQaLP18.sp(21) : warning 217: loose indentation
/home/groups/sourcemod/upload_tmp/textQaLP18.sp(24) : warning 217: loose indentation
/home/groups/sourcemod/upload_tmp/textQaLP18.sp(25) : error 029: invalid expression, assumed zero
/home/groups/sourcemod/upload_tmp/textQaLP18.sp(25) : warning 221: label name "Float" shadows tag name
/home/groups/sourcemod/upload_tmp/textQaLP18.sp(25) : error 017: undefined symbol "Points1"
/home/groups/sourcemod/upload_tmp/textQaLP18.sp(26) : error 029: invalid expression, assumed zero
/home/groups/sourcemod/upload_tmp/textQaLP18.sp(26) : warning 221: label name "Float" shadows tag name
/home/groups/sourcemod/upload_tmp/textQaLP18.sp(26) : error 017: undefined symbol "Total1"
/home/groups/sourcemod/upload_tmp/textQaLP18.sp(28) : warning 217: loose indentation
/home/groups/sourcemod/upload_tmp/textQaLP18.sp(28) : error 017: undefined symbol "Total1"
Thanks in advance.
Marley is offline
Lebson506th
Veteran Member
Join Date: Jul 2008
Old 12-03-2008 , 16:43   Re: [TF2] MVP help
Reply With Quote #5

Code:
public OnPluginStart()
{
    HookEvent("teamplay_win_panel", hookMVP1, EventHookMode_Post);
}

public Action:hookMVP1(Handle:event, const String:name[], bool:dontBroadcast)
{
    new MVP1 = GetClientOfUserId(GetEventInt(event, "player_1"));
    new p1 = GetEventInt(event, "player_1_points");

    new Float:exp15 = 15.0;
    new Float:Points1 = float(p1);
    new Float:Total1 = FloatAdd(exp15, Points1);

    PrintToChat(MVP1, "\x01\x03[\x04Test\x03] \x04Awarded %f Experience for being MVP 1", Total1);
}
Indent errors means always use tabs, never spaces.

As for the rest, it was some syntax and function use errors.
__________________
My Plugins
Spray Tracer by Nican, maintained by me
Simple TK Manager
DoD:S Admin Weapons

Links
Resistance and Liberation (A HL2 Multiplayer Modification)
Lebson506th is offline
Marley
Junior Member
Join Date: Oct 2008
Old 12-03-2008 , 16:58   Re: [TF2] MVP help
Reply With Quote #6

Thank you very much . Gotta love AlliedModders community
Marley is offline
Lebson506th
Veteran Member
Join Date: Jul 2008
Old 12-04-2008 , 09:06   Re: [TF2] MVP help
Reply With Quote #7

Sorry, i was just stating my preference.
__________________
My Plugins
Spray Tracer by Nican, maintained by me
Simple TK Manager
DoD:S Admin Weapons

Links
Resistance and Liberation (A HL2 Multiplayer Modification)
Lebson506th 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 22:56.


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