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

I try to make mod with xp.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fry!
Veteran Member
Join Date: Apr 2008
Location: Latvia
Old 05-31-2008 , 13:27   I try to make mod with xp.
Reply With Quote #1

Ok , yesterday I look into this Tutorial > http://forums.alliedmods.net/showthread.php?t=66497 so I decide create my first mod but I today tryed to compile and there was some errors but I did all what was in this tutorial. Is this tutorial wrong or I had something write wrong. Please correct me/plugin . (Plugin is unfinished) .
__________________
Quote:
Originally Posted by wisam187
why all the great scriptors..... always.... leave and let their works go into oblivion ???
i miss your way in making outstanding plugins...
this forum needs lots of the likes of you..... and less of the idiots that spread right now.

Last edited by Fry!; 06-07-2008 at 14:53. Reason: .sma not needed anymore
Fry! is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 05-31-2008 , 14:19   Re: Try make mod. please help .
Reply With Quote #2

These errors are simple.
Learn english.

* You forgot a new row at places.
* You can't name functions exactly like a variable.
* The array thing is in pure english. You exceed the size of the array.
* If you can't see what's wrong with this you shouldn't code at all.
Code:
client_print(id,print_chat(id,print_chat,"You are alredy a %s",CLASSES[i]);
[ --<-@ ] Black Rose is offline
Fry!
Veteran Member
Join Date: Apr 2008
Location: Latvia
Old 05-31-2008 , 14:40   Re: Try make mod. please help .
Reply With Quote #3

mm Thanks . Like I set It was yesterday at my time 24:00 when try to code something and I was sleepy . Lol I dont know why I write that text to times .

Quote:
* If you can't see what's wrong with this you shouldn't code at all.
Well somehow I need/want to learn coding stuff . ;/
__________________
Quote:
Originally Posted by wisam187
why all the great scriptors..... always.... leave and let their works go into oblivion ???
i miss your way in making outstanding plugins...
this forum needs lots of the likes of you..... and less of the idiots that spread right now.

Last edited by Fry!; 05-31-2008 at 14:44.
Fry! is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-31-2008 , 14:40   Re: Try make mod. please help .
Reply With Quote #4

1. You created a variable and a function with the same name. (PlayerClass)

2. register_event("ResetHUD","on_spawn","be")
THAT IS TERRIBLE!
http://forums.alliedmods.net/showthread.php?t=42159

3. Your id and attacker are global... wtf?
You need to create those in the Death function and retrieve the data.

4. <incorrect>

5. You have two statements on one line, without a semicolon..
Code:
PlayerClass[id] = i client_print(id,print_chat,"You are now a %s",CLASSES[i])
should be:
Code:
PlayerClass[id] = i client_print(id,print_chat,"You are now a %s",CLASSES[i])

6. Typo
Code:
client_print(id,print_chat,"You are alredy a %s",CLASSES[i]);
should be:
Code:
client_print(id,print_chat,"You are already a %s",CLASSES[i]);

7. You don't need the second # symbol when you save/load data since you only use 2 numbers.
Also, you can just space out the numbers, instead of putting a # in the middle.
Also, you don't need to format the vaultdata if you are loading it
Code:
public SaveData(id) {         new AuthID[35]     get_user_authid(id,AuthID,34)     new vaultkey[64],vaultdata[256]       format(vaultkey,63,"%s Mod",AuthID)     format(vaultdata,255,"%i#%i#",PlayerXP[id],PlayerLevel[id])       nvault_set(g_vault,vaultkey,vaultdata)     return PLUGIN_CONTINUE } public LoadData(id) {     new AuthID[35]     get_user_authid(id,AuthID,34)     new vaultkey[64],vaultdata[256]     format(vaultkey,63,"%s Mod",AuthID)     format(vaultdata,255,"%i#%i#",PlayerXP[id],PlayerLevel[id])     nvault_get(g_vault,vaultkey,vaultdata,255)     replace_all(vaultdata, 255, "#", " ")     new playerxp[32], playerlevel[32]     parse(vaultdata, playerxp, 31, playerlevel, 31)     PlayerXP[id] = str_to_num(playerxp)     PlayerLevel[id] = str_to_num(playerlevel)     return PLUGIN_CONTINUE }
should be:
Code:
public SaveData(id) {         new AuthID[35]     get_user_authid(id,AuthID,34)     new vaultkey[64],vaultdata[256]       format(vaultkey,63,"%s Mod",AuthID)     format(vaultdata,255,"%i %i",PlayerXP[id],PlayerLevel[id])       nvault_set(g_vault,vaultkey,vaultdata)     return PLUGIN_CONTINUE } public LoadData(id) {     new AuthID[35]     get_user_authid(id,AuthID,34)     new vaultkey[64],vaultdata[256]     format(vaultkey,63,"%s Mod",AuthID)     nvault_get(g_vault,vaultkey,vaultdata,255)     new playerxp[32], playerlevel[32]     parse(vaultdata, playerxp, 31, playerlevel, 31)     PlayerXP[id] = str_to_num(playerxp)     PlayerLevel[id] = str_to_num(playerlevel)     return PLUGIN_CONTINUE }

8. This could be way better coded.
Code:
public PlayerClass(id) {     if (PlayerClass[id] == CLASS_SOLDIER && PlayerLevel[id] == 2)     {         set_user_health(id, 102);         give_item(id,"weapon_m249");     }     if (PlayerClass[id] == CLASS_SOLDIER && PlayerLevel[id] == 3)     {         set_user_health(id, 104);         set_user_armor(id, 105);     }     if (PlayerClass[id] == CLASS_SOLDIER && PlayerLevel[id] == 4)     {         set_user_health(id, 106);         set_user_armor(id, 110);     }     if (PlayerClass[id] == CLASS_SOLDIER && PlayerLevel[id] == 5)     {         set_user_health(id, 108);         set_user_armor(id, 115);     }     if (PlayerClass[id] == CLASS_SOLDIER && PlayerLevel[id] == 6)     {         set_user_health(id, 110);         set_user_armor(id, 120);     }     if (PlayerClass[id] == CLASS_SOLDIER && PlayerLevel[id] == 7)     {         set_user_health(id, 112);         set_user_armor(id, 125);     }     if (PlayerClass[id] == CLASS_SOLDIER && PlayerLevel[id] == 8)     {         set_user_health(id, 114);         set_user_armor(id, 130);     }     if (PlayerClass[id] == CLASS_SOLDIER && PlayerLevel[id] == 9)     {         set_user_health(id, 116);         set_user_armor(id, 135);     }     if (PlayerClass[id] == CLASS_SOLDIER && PlayerLevel[id] == 10)     {         set_user_health(id, 118);         set_user_armor(id, 140);     }     }
should be:
Code:
public PlayerClass(id) {     if (PlayerClass[id] == CLASS_SOLDIER)     {         switch(PlayerLevel[id])         {             case 2:             {                 set_user_health(id, 102);                 give_item(id,"weapon_m249");             }             case 3:             {                 set_user_health(id, 104);                 set_user_armor(id, 105);             }             case 4:             {                 set_user_health(id, 106);                 set_user_armor(id, 110);             }             // etc...         }     } }

9.
Code:
#include <fun>
you should use fakemeta_util
http://forums.alliedmods.net/showthread.php?t=28284
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 05-31-2008 at 16:11.
Exolent[jNr] is offline
Fry!
Veteran Member
Join Date: Apr 2008
Location: Latvia
Old 05-31-2008 , 15:04   Re: Try make mod. please help .
Reply With Quote #5

wow , Thanks for this big reply .
__________________
Quote:
Originally Posted by wisam187
why all the great scriptors..... always.... leave and let their works go into oblivion ???
i miss your way in making outstanding plugins...
this forum needs lots of the likes of you..... and less of the idiots that spread right now.
Fry! is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 05-31-2008 , 15:25   Re: Try make mod. please help .
Reply With Quote #6

Quote:
Originally Posted by X-olent View Post
Code:
new AuthID[35] get_user_authid(id,AuthID,34)
should be:
Code:
new AuthID[35] get_user_authid(id,AuthID,34)

Code:
client_print(id,print_chat(id,print_chat,"You are alredy a %s",CLASSES[i]);
should be:
Code:
client_print(id,print_chat(id,print_chat,"You are already a %s",CLASSES[i]);
How could you miss these simple things? I mentioned them in my post.

Quote:
Originally Posted by X-olent View Post
8. This could be way better coded.

Code:
public PlayerClass(id) {     if (PlayerClass[id] == CLASS_SOLDIER && PlayerLevel[id] == 2)     {         set_user_health(id, 102);         give_item(id,"weapon_m249");     }     if (PlayerClass[id] == CLASS_SOLDIER && PlayerLevel[id] == 3)     {         set_user_health(id, 104);         set_user_armor(id, 105);     }     if (PlayerClass[id] == CLASS_SOLDIER && PlayerLevel[id] == 4)     {         set_user_health(id, 106);         set_user_armor(id, 110);     }     if (PlayerClass[id] == CLASS_SOLDIER && PlayerLevel[id] == 5)     {         set_user_health(id, 108);         set_user_armor(id, 115);     }     if (PlayerClass[id] == CLASS_SOLDIER && PlayerLevel[id] == 6)     {         set_user_health(id, 110);         set_user_armor(id, 120);     }     if (PlayerClass[id] == CLASS_SOLDIER && PlayerLevel[id] == 7)     {         set_user_health(id, 112);         set_user_armor(id, 125);     }     if (PlayerClass[id] == CLASS_SOLDIER && PlayerLevel[id] == 8)     {         set_user_health(id, 114);         set_user_armor(id, 130);     }     if (PlayerClass[id] == CLASS_SOLDIER && PlayerLevel[id] == 9)     {         set_user_health(id, 116);         set_user_armor(id, 135);     }     if (PlayerClass[id] == CLASS_SOLDIER && PlayerLevel[id] == 10)     {         set_user_health(id, 118);         set_user_armor(id, 140);     }     }
should be:

Code:
public PlayerClass(id) {     if (PlayerClass[id] == CLASS_SOLDIER)     {         switch(PlayerLevel[id])         {             case 2:             {                 set_user_health(id, 102);                 give_item(id,"weapon_m249");             }             case 3:             {                 set_user_health(id, 104);                 set_user_armor(id, 105);             }             case 4:             {                 set_user_health(id, 106);                 set_user_armor(id, 110);             }             // etc...         }     } }
Could be even better...
Code:
public PlayerClass(id) {     if (PlayerClass[id] == CLASS_SOLDIER) {         if ( PlayerLevel[id] == 2 )             give_item(id,"weapon_m249");     set_user_armor(id, PlayerLevel[id] * 5 - 10);     set_user_health(id, PlayerLevel[id] * 2 + 98);     } }

Last edited by [ --<-@ ] Black Rose; 05-31-2008 at 15:34.
[ --<-@ ] Black Rose is offline
Fry!
Veteran Member
Join Date: Apr 2008
Location: Latvia
Old 05-31-2008 , 15:34   Re: Try make mod. please help .
Reply With Quote #7

Yeah, it's simple but when you are sleepy it's hardly to notice . :/ Thanks for a help .
__________________
Quote:
Originally Posted by wisam187
why all the great scriptors..... always.... leave and let their works go into oblivion ???
i miss your way in making outstanding plugins...
this forum needs lots of the likes of you..... and less of the idiots that spread right now.
Fry! is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-31-2008 , 15:57   Re: Try make mod. please help .
Reply With Quote #8

I didn't really pay much attention.
Just did a quick run through.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fxfighter
Veteran Member
Join Date: Feb 2007
Location: Trollhättan
Old 05-31-2008 , 16:09   Re: Try make mod. please help .
Reply With Quote #9

Quote:
Originally Posted by X-olent View Post

4. Also, you set your classes wrong in the menu with the numbers.
Either, decrease the menu numbers by one, or change this line:
Code:
new i = str_to_num(szCommand)

to:
Code:
new i = str_to_num(szCommand) - 1
You culdnt be more incorect thare.
You messs up the classes so if the pick solder they will get class none and so one.
The 0 slot is for class none that will be the defult class when they join.
__________________
If one of my plugins become broken, contact me by mail. [email protected]
fxfighter is offline
Send a message via MSN to fxfighter
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-31-2008 , 16:11   Re: Try make mod. please help .
Reply With Quote #10

lol I didn't see that "None" was a variable option.
My bad.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 17:38.


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