Raised This Month: $ Target: $400
 0% 

Help with my plugin


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Author Message
Dizzy
Veteran Member
Join Date: Jun 2004
Location: Massachusetts
Old 04-29-2006 , 22:04   Help with my plugin
#1

Alright, this isn't a plugin test anymore, I guess I need help

Well here is what I have,

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> new bool:idtype[id] public plugin_init() {     register_plugin("Clan Models","0.1","Dizzy")     register_event("ResetHUD", "modelreset", "b")     new configsDir[64]     get_configsdir(configsDir, 63)     format(configsDir, 63, "%s/clan.cfg", configsDir)     return PLUGIN_HANDLED } public client_connect(id) {     idtype[id] = false } public client_disconnect(id) {     idtype[id] = false } public plugin_precache() {         precache_model("models/clanmodels/clanter.mdl")         precache_model("models/clanmodels/clanct.mdl")         return PLUGIN_CONTINUE } public modelreset(id, level, cid) {     new t_arg[16]     read_argv(4, t_arg, 15)     if (equali(t_arg, "steam") || equali(t_arg, "steamid") || equali(t_arg, "auth"))     {         idtype[id] = true     }     if (idtype[id] = true)     {         new CsTeams:userTeam = cs_get_user_team(id)         if (userTeam == CS_TEAM_T)         {             cs_set_user_model(id, "clanter")         }         if(userTeam == CS_TEAM_CT)         {             cs_set_user_model(id, "clanct")         }     } return PLUGIN_CONTINUE }

It is suppose to change the model of a person who is in the clan.cfg file...

So basically, you put a user's steamid into "clan.cfg" and when the round resets, their model changes to either clanter.mdl or clanct.mdl depending on what team they are on.

Thanks in advance guys!
Dizzy is offline
Send a message via AIM to Dizzy
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-29-2006 , 23:16  
#2

It's not going to work.

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> new bool:idtype[id] public plugin_init() {     register_plugin("Clan Models","0.1","Dizzy")     register_event("ResetHUD", "modelreset", "b")     new configsDir[64]     get_configsdir(configsDir, 63)     format(configsDir, 63, "%s/clan.cfg", configsDir)     loadSettings(configsDir) // this function doesn't exist!     return PLUGIN_HANDLED } public client_connect(id) {     idtype[id] = false } public client_disconnect(id) {     idtype[id] = false } public plugin_precache() {         precache_model("models/clanmodels/clanter.mdl")         precache_model("models/clanmodels/clanct.mdl")         return PLUGIN_CONTINUE } // You need to delay this slightly with a task and such public modelreset(id, level, cid) {     new t_arg[16]     read_argv(4, t_arg, 15) // what the hell is this? jibberish, eh?     if (equali(t_arg, "steam") || equali(t_arg, "steamid") || equali(t_arg, "auth"))     {         idtype[id] = true     }     if (idtype[id] = true)     {         new CSTEAMS:userTeam = cs_get_user_team(id) // it's CsTeams, not CSTEAMS         if (userTeam == CS_TEAM_T)         {             cs_set_user_model(id, "clanter")         }         if(userTeam == CS_TEAM_CT)         {                         cs_set_user_model(id, "clanct")         }     }     return PLUGIN_CONTINUE }
It needs some major work.

Moving this to "Scripting Help".
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
gene
Member
Join Date: Oct 2005
Old 04-30-2006 , 01:32  
#3

i have 4 and lots of players so ill help anyway i can. just pm me when/if ya need me
__________________
|DF| CLAN LEADER
http:destructiveforce.org
gene is offline
Dizzy
Veteran Member
Join Date: Jun 2004
Location: Massachusetts
Old 04-30-2006 , 16:02  
#4

Yeah, v3x I wasn't sure how to make it check a .cfg file for STEAM ID's listed...

I tried to look at the admin.sma that comes with amxmodx, but I guess I was extremely unsuccessful, halp plz!
Dizzy is offline
Send a message via AIM to Dizzy
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-30-2006 , 19:22  
#5

Look at my "Clan tag checker" plugin.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 04-30-2006 , 19:26  
#6

Quote:
Originally Posted by Dizzy
Yeah, v3x I wasn't sure how to make it check a .cfg file for STEAM ID's listed...

I tried to look at the admin.sma that comes with amxmodx, but I guess I was extremely unsuccessful, halp plz!
Could you please tell us what you are trying to do, since I don't really see it

If you are trying to load things from a file:

Code:
//Load the data new filepath[64]; get_configsdir(filepath, 63); format(filepath, 63, "%s/myfile.cfg", filepath);     if(file_exists(filepath)) {     new output[128];         //Open file     new fHandle = fopen(filepath, "rt");         //Checks for failure     if(!fHandle)         return;         //Loop through all lines     for(new a = 0; !feof(fHandle); a++)     {         //Get line         fgets(fHandle, output, 511);         //PUT YOUR OWN CODE HERE <---     } }
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
Dizzy
Veteran Member
Join Date: Jun 2004
Location: Massachusetts
Old 05-01-2006 , 01:18  
#7

Alright, here's what I want, I want this plugin to check clanmodels.cfg for STEAM ID's and if your STEAM ID is in the clanmodels.cfg, it will change your CS model to either clanter.mdl or clanct.mdl depending on what Team you are on...

Here's what I have

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> public plugin_init() {     register_plugin("Clan Models","0.1","Dizzy")     register_event("ResetHUD", "modelreset", "b")     return PLUGIN_HANDLED } public plugin_precache() {     precache_model("models/clanmodels/clanter.mdl")     precache_model("models/clanmodels/clanct.mdl")     return PLUGIN_CONTINUE } public modelreset(id, level, cid) {     new filepath[64]     get_configsdir(filepath, 63)     format(filepath, 63, "%s/clanmodels.cfg", filepath)     if(file_exists(filepath))     {         new output[128]         new fHandle = fopen(filepath, "rt")             if(!fHandle)             return                 for(new a = 0; !feof(fHandle); a++)             {             fgets(fHandle, output, 511)             new CsTeams:userTeam = cs_get_user_team(id)             if (userTeam == CS_TEAM_T)             {                 cs_set_user_model(id, "clanter")             }             if(userTeam == CS_TEAM_CT)             {                 cs_set_user_model(id, "clanct")             }         }     } return PLUGIN_HANDLED }

Thanks in advance =)
Dizzy is offline
Send a message via AIM to Dizzy
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 05-01-2006 , 08:12  
#8

Not tested, but it compiles okay

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> public plugin_init() {     register_plugin("Clan Models","0.1","Dizzy")     register_event("ResetHUD", "modelreset", "b")     return PLUGIN_HANDLED } public plugin_precache() {     precache_model("models/clanter/clanter.mdl")     precache_model("models/clanct/clanct.mdl")     return PLUGIN_CONTINUE } public modelreset(id) {     //Get filepath     new filepath[64]     get_configsdir(filepath, 63)     format(filepath, 63, "%s/clanmodels.cfg", filepath)     if(file_exists(filepath))     {         new output[128]         new fHandle = fopen(filepath, "rt")         if(!fHandle)             return PLUGIN_CONTINUE         for(new a = 0; !feof(fHandle); a++)         {             //Get line             fgets(fHandle, output, 511)                 //Check if line is invalid             if(output[0] == ';' || !output[0] || output[0] == ' ' || output[0] == 10)                 continue;                             //Get authid             new authid[35]             get_user_authid(id, authid, 34)                         //Containi is used since I'm not in the mood of stripping newlines             if(containi(output, authid) != -1)             {                 new CsTeams:userTeam = cs_get_user_team(id)                         if (userTeam == CS_TEAM_T)                 {                     cs_set_user_model(id, "clanter")                 }                     if(userTeam == CS_TEAM_CT)                 {                     cs_set_user_model(id, "clanct")                 }               }         }     }         return PLUGIN_CONTINUE; }

One small note: Make sure the folder where de models are in is named the same as the model itself.

EG: models/clanter/clanter.mdl and NOT models/clanmodels/clanter.mdl
Same with the CT models offcourse

Good luck
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-01-2006 , 16:00  
#9

That's a terrible way of doing it. You should load the files on startup, then store them all in a global variable. Here, I'll show you:
Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> new filestr[84]; public plugin_init() {     register_plugin("Clan Models","0.1","Dizzy")     register_event("ResetHUD", "modelreset", "b")     new configs_dir[64]     get_configsdir(configs_dir , 63);     format(filestr, 83 , "%s/clanmodels.cfg" , configs_dir);     set_task(0.1 , "load_authids");     return PLUGIN_HANDLED } public plugin_precache() {     precache_model("models/clanter/clanter.mdl")     precache_model("models/clanct/clanct.mdl")     return PLUGIN_CONTINUE } new bool:can_change[33]; public client_connect(id) can_change[id] = false; public client_disconnect(id) can_change[id] = false; public modelreset(id) {     if(can_change[id])     {         new CsTeams:team = cs_get_user_team(id);         switch(team)         {             case CS_TEAM_T: cs_set_user_model(id , "clanter");             case CS_TEAM_CT: cs_set_user_model(id , "clanct");         }     } } public load_authids(id) {     if(file_exists(filestr))     {         new output[128]         new fHandle = fopen(filestr, "rt")         if(!fHandle)             return PLUGIN_CONTINUE         for(new a = 0; !feof(fHandle); a++)         {             //Get line             fgets(fHandle, output, 511)             remove_quotes(output);                 //Check if line is invalid             if(output[0] == ';' || !output[0] || output[0] == ' ' || output[0] == 10)                 continue;                             //Get authid             new authid[33]             get_user_authid(id, authid, 32)                         //Containi is used since I'm not in the mood of stripping newlines             if(equal(authid , output))             {                 can_change[id] = true;              }         }     }     else     {         log_amx("%s not found" , filestr);     }         return PLUGIN_CONTINUE; }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 05-01-2006 , 17:22  
#10

That's right. But I was in a hurry when I made it (no exuse though =P)

[offtopic]BTW. Why are you doing me -3 karma hits every day V3X. Together with Su1cide[/offtopic]
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
Closed Thread



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 05:08.


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