Raised This Month: $ Target: $400
 0% 

Getting there, sort of


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Gor.d
Junior Member
Join Date: Mar 2004
Location: South Carolina
Old 04-30-2004 , 00:43   Getting there, sort of
Reply With Quote #1

Code:
/* AMX Mod script. * * (c) Copyright 2002, SuicideDog * * Plugin changes map when teams are lopsided and * one side gets skunked * * Code gleemed for OLO'S Win Limit plugin * This file is provided as is (no warranties). * */ #include <amxmodx> new ct_score = 0 new terrorist_score = 0 new Float:last_timelimit new winlimit public change_map(){     last_timelimit = get_cvar_float("mp_timelimit")     set_cvar_float("mp_timelimit",0.01) } public back_timelimit()     set_cvar_float("mp_timelimit",last_timelimit) public new_round(){     winlimit = get_cvar_num("amx_skunk")     set_hudmessage(200, 100, 0, 0.05, 0.5, 0, 6.0, 6.0, 0.5, 0.15, 4)             if (ct_score == winlimit && terrorist_score == 0){             set_task(4.0,"change_map")             show_hudmessage(0,"CT's have SKUNKED T's with score of %d to %d^nChanging map...",ct_score,terrorist_score)     }     else if (terrorist_score == winlimit && ct_score == 0){             set_task(4.0,"change_map")             show_hudmessage(0,"T's have SKUNKED CT's with score of %d to %d^nChanging map...",terrorist_score,ct_score)     }     return PLUGIN_CONTINUE } public team_score(){     new team[2]     read_data(1,team,1)     if (team[0]=='C')         ct_score = read_data(2)     else if (team[0]=='T')         terrorist_score = read_data(2)     return PLUGIN_CONTINUE } public plugin_init(){     register_plugin("Skunkage","0.2","SuicideDog")     register_event("TeamScore", "team_score", "a")     register_event("RoundTime", "new_round", "bc")     register_event("30", "back_timelimit", "a")     register_cvar("amx_skunk","7")     return PLUGIN_CONTINUE }

In the first part he is declaring new variables. The first two are set to 0. The third is a float which is a number with a decimal in it. The last, winlimit, is empty at this point.

Next, he declares the function change_map which stores the current time limit to "last_timelimit", and then changes the time limit to 0.01 seconds. The next function sets the time limit back to default.

Under the new_round function he sets winlimit to amx_skunk which is registered below as 7. I know nothing about the hud message formatting (I'll work on that later). Then if the ct_score equals the win limit and the t score equals 0, show the hud mesage globally and then run the change_map in 4 seconds. If not, then check the opposite. If neither are true then keep checking until one or the other becomes true.

In the team_score function he defines a new array named team which holds two numbers. The next part totally looses me
Code:
read_data(1,team,1) if (team[0]=='C')      ct_score = read_data(2) else if (team[0]=='T')      terrorist_score = read_data(2) return PLUGIN_CONTINUE }

Could I trouble someone to explain to me the last part? I would greatly appreciate it.
Gor.d is offline
Send a message via AIM to Gor.d Send a message via MSN to Gor.d Send a message via Yahoo to Gor.d
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 04-30-2004 , 06:05  
Reply With Quote #2

Code:
read_data(1,team,1) if (team[0]=='C')      ct_score = read_data(2) else if (team[0]=='T')      terrorist_score = read_data(2) return PLUGIN_CONTINUE }

1) he reads 1 byte from parameter 1 of the message. Param1 is the team: CT or T probably
2) he compares the read byte to C and T. If it is C, he assigns the param2 (that is the score) to CT score global variable, if it is T, he assigns the param2 to the T score global variable.

read_data with one parameter reads the msg param as an int, with 3 parameters it reads the msg param as a string...
__________________
hello, i am pm
PM is offline
RPRaiden
Member
Join Date: Apr 2004
Location: UK
Old 04-30-2004 , 13:49  
Reply With Quote #3

yes but what are the affects of doing that?
What can it be used for, im curious.
__________________
RPRaiden is offline
Send a message via ICQ to RPRaiden Send a message via AIM to RPRaiden Send a message via MSN to RPRaiden Send a message via Yahoo to RPRaiden
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 04-30-2004 , 14:27  
Reply With Quote #4

huh? You can catch mod specific messages that the server sends to the client with it. For example one team wins, scoreboard info, etc etc...
__________________
hello, i am pm
PM is offline
Gor.d
Junior Member
Join Date: Mar 2004
Location: South Carolina
Old 04-30-2004 , 17:33  
Reply With Quote #5

Thanks for the reply PM. That's still a little over my head. I'm looking for more info on read_data in the small doc.

I hope that since you didn't say anything about the rest of the post I had some of it right.
Gor.d is offline
Send a message via AIM to Gor.d Send a message via MSN to Gor.d Send a message via Yahoo to Gor.d
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 05-01-2004 , 05:06  
Reply With Quote #6

You won't find anything about read_data in the small docs, because its an AMX(X) specific function.
I haven't tested your code; to see whether it works, compile & run it...
__________________
hello, i am pm
PM 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:58.


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