new name[32]; get_user_name(id,name,31); replace_all(name, 31, " ", "'") new vaultkey[64],vaultdata[256] format(vaultkey,63,"%s-Dbmod",name) format(vaultdata,255,"%i#%i#%i#%i#%i#%i#%i#%i",player_class[id],player_<img src='https://amxx.pl/public/style_emoticons/<#EMO_DIR#>/tongue2.gif' class='bbc_emoticon' alt='xP' />[id],player_lvl[id],player_intelligence[id],player_strength[id],player_point[id],player_agility[id],player_dextery[id]) nvault_set(g_vault,vaultkey,vaultdata) return PLUGIN_HANDLED
Witamy w Nieoficjalnym polskim support'cie AMX Mod X
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Script Problem.
#21
Napisano 20.04.2009 21:49
#23
Napisano 20.04.2009 21:56
[ Added: 20-04-2009, 23:06 ]
public SaveXP(id){ new playerid[32]; get_user_authid(id,playerid,MAX_ID_LENGTH-1); replace_all(playerid, MAX_ID_LENGTH-1, " ", "'") new vaultkey[64],vaultdata[256] format(vaultkey,63,"%s-Dbmod",playerid) format(vaultkey,63,"%s-%d-Dbmod",playerid,player_class[id]) format(vaultdata,255,"%i#%i#%i#%i#%i#%i#%i#%i",player_class[id],player_<img src='https://amxx.pl/public/style_emoticons/<#EMO_DIR#>/tongue2.gif' class='bbc_emoticon' alt='xP' />[id],player_lvl[id],player_intelligence[id],player_strength[id],player_point[id],player_agility[id],player_dextery[id]) nvault_set(g_vault,vaultkey,vaultdata) return PLUGIN_HANDLED } public LoadXP(id){ new playerid[32]; get_user_authid(id,playerid,MAX_ID_LENGTH-1); replace_all(playerid, MAX_ID_LENGTH-1, " ", "'") new vaultkey[64],vaultdata[256] format(vaultkey,63,"%s-Dbmod",playerid) format(vaultkey,63,"%s-%d-Dbmod",playerid,player_class[id]) format(vaultdata,255,"%i#%i#%i#%i#%i#%i#%i#%i",player_class[id],player_<img src='https://amxx.pl/public/style_emoticons/<#EMO_DIR#>/tongue2.gif' class='bbc_emoticon' alt='xP' />[id],player_lvl[id],player_intelligence[id],player_strength[id],player_point[id],player_agility[id],player_dextery[id]) nvault_get(g_vault,vaultkey,vaultdata,255) replace_all(vaultdata, 255, "#", " ") new playerclass[33], playerxp[33],playerlvl[33],playerintelligence[33],playerstrength[33],playerpoint[33],playeragility[33],playerdextery[33] parse(vaultdata, playerclass, 32, playerxp, 32, playerlvl, 32, playerintelligence, 32, playerstrength, 32, playerpoint, 32, playeragility, 32, playerdextery, 32) player_class[id] = str_to_num(playerclass) player_<img src='https://amxx.pl/public/style_emoticons/<#EMO_DIR#>/tongue2.gif' class='bbc_emoticon' alt='xP' />[id] = str_to_num(playerxp) player_lvl[id] = str_to_num(playerlvl) player_intelligence[id] = str_to_num(playerintelligence) player_strength[id] = str_to_num(playerstrength) player_point[id] = str_to_num(playerpoint) player_agility[id] = str_to_num(playeragility) player_dextery[id] = str_to_num(playerdextery) BoostRing(id) BoostStats(id,player_b_extrastats[id]) player_damreduction[id] = (47.3057*(1.0-floatpower( 2.7182, -0.06798*float(player_agility[id])))/100) give_knife(id) return PLUGIN_HANDLED }
Would this be proper?
#24
Napisano 20.04.2009 22:17
get_user_authid(id,playerid,34);
steam have max 34 chars
replace_all(playerid, MAX_ID_LENGTH-1, " ", "'") - steam dont have spaces " " in it so it isn't needed.
format(vaultkey,63,"%s-Dbmod",playerid)
format(vaultkey,63,"%s-%d-Dbmod",playerid,player_class[id])
format will erase all data before entering new data (so single format [the secound one] will be only in vaultkey)
format(vaultdata,255,"%i#%i#%i#%i#%i#%i#%i#%i",player_class[id] playerclass is in kay so it isn't nesesery in data.
LoadXP funktion is pretty bad to...
nvault_get(g_vault,vaultkey,vaultdata,255)
in vaultdata will be stored (formated before that) all data from database so don't see the point of formating data there...
#25
Napisano 20.04.2009 22:19
Edit1: oh and for the load instead of all the i just need the get_vault thing?
Edit2:
public SaveXP(id){ new playerid[35]; get_user_authid(id,playerid,34); replace_all(playerid, MAX_ID_LENGTH-1, " ", "") new vaultkey[64],vaultdata[256] format(vaultkey,63,"%s-Dbmod",playerid) format(vaultkey,63,"%s-%d-Dbmod",playerid,player_class[id]) format(vaultdata,255,"%i#%i#%i#%i#%i#%i#%i#%i",player_<img src='https://amxx.pl/public/style_emoticons/<#EMO_DIR#>/tongue2.gif' class='bbc_emoticon' alt='xP' />[id],player_lvl[id],player_intelligence[id],player_strength[id],player_point[id],player_agility[id],player_dextery[id]) nvault_set(g_vault,vaultkey,vaultdata) return PLUGIN_HANDLED } public LoadXP(id){ nvault_get(g_vault,vaultkey,vaultdata,255) replace_all(vaultdata, 255, "#", " ") new playerclass[33], playerxp[33],playerlvl[33],playerintelligence[33],playerstrength[33],playerpoint[33],playeragility[33],playerdextery[33] parse(vaultdata, playerclass, 32, playerxp, 32, playerlvl, 32, playerintelligence, 32, playerstrength, 32, playerpoint, 32, playeragility, 32, playerdextery, 32) player_class[id] = str_to_num(playerclass) player_<img src='https://amxx.pl/public/style_emoticons/<#EMO_DIR#>/tongue2.gif' class='bbc_emoticon' alt='xP' />[id] = str_to_num(playerxp) player_lvl[id] = str_to_num(playerlvl) player_intelligence[id] = str_to_num(playerintelligence) player_strength[id] = str_to_num(playerstrength) player_point[id] = str_to_num(playerpoint) player_agility[id] = str_to_num(playeragility) player_dextery[id] = str_to_num(playerdextery) BoostRing(id) BoostStats(id,player_b_extrastats[id]) player_damreduction[id] = (47.3057*(1.0-floatpower( 2.7182, -0.06798*float(player_agility[id])))/100) give_knife(id) return PLUGIN_HANDLED }
Do i need to delete al lteh player_class things like the new player class [33]?
#26
Napisano 20.04.2009 22:28
To tell the truth even if code will look ok it could have some gliches like letter in frong place or somethin less important and it will not work. So for now i think about removing step by step every bad code that can be spoted and then test it, debug, test, debug and after some time it should work.
I'm pretty good in that... in 5 minutes i can run over 20 (or less - dam plug have long compiling time) fast test and removing those dam bugs
#27
Napisano 20.04.2009 22:29
in that is stored what class you have in the game when you play really important for all classes bonuses....Do i need to delete al lteh player_class things like the new player class [33]?
#28
Napisano 20.04.2009 22:33
register_clcmd("say /skills", "showskills") register_clcmd("say /classes","show_menu_klasy") register_menucmd(register_menuid("Skill Menu"), 1023, "skill_menu") register_menucmd(register_menuid("Class Info"), 1023, "klasy") register_menucmd(register_menuid("Options"), 1023, "option_menu") register_menucmd(register_menuid("Select Class"), 1023, "select_class_menu") register_menucmd(register_menuid("Rune Shop"), 1023, "select_rune_menu") register_menucmd(register_menuid("New Items"), 1023, "nowe_itemy") public showskills(id) { new Skillsinfo[768] format(Skillsinfo,767,"You have %i strength - this give you %i extra hitpoints You have %i Dextery - this give a speed boost of %i% and reduce magic damage taken with %i%% You have %i Agility - Helps to find unique items and reduce damage from normal attacks by %0.0f%% You have %i intelligence - this will make the USE items more efficient ", player_strength[id], player_strength[id]*2, player_dextery[id], floatround(player_dextery[id]*1.3), player_dextery[id]*3, player_agility[id], player_damreduction[id]*100, player_intelligence[id]) showitem(id,"Skills","None","None", Skillsinfo) } public skilltree(id) { new text[513] new keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6) format(text, 512, "ySelect skill - rPoints: %i^n^nw1. Intelligence [%i] [More Spell Damage]^nw2. Strength [%i] [More Hitpoints]^nw3. Agility [%i] [Damage reduction]^nw4. Dextery [%i] [Improved Speed and Magic damage reduction]",player_point[id],player_intelligence[id],player_strength[id],player_agility[id],player_dextery[id]) keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6) show_menu(id, keys, text) return PLUGIN_HANDLED } public skill_menu(id, key) { switch(key) { case 0: { if (player_intelligence[id]<50){ player_point[id]-=1 player_intelligence[id]+=1 } else client_print(id,print_center,"You have maxed out the intelligence skill") } case 1: { if (player_strength[id]<50){ player_point[id]-=1 player_strength[id]+=1 } else client_print(id,print_center,"You have maxed out the strength skill") } case 2: { if (player_agility[id]<50){ player_point[id]-=1 player_agility[id]+=1 player_damreduction[id] = (47.3057*(1.0-floatpower( 2.7182, -0.06798*float(player_agility[id])))/100) } else client_print(id,print_center,"You have maxed out the agility skill") } case 3: { if (player_dextery[id]<50){ player_point[id]-=1 player_dextery[id]+=1 set_speedchange(id) } else client_print(id,print_center,"You have maxed out the dextery skill") } } if (player_point[id] > 0) skilltree(id) return PLUGIN_HANDLED } [b]Klasy =)[/b] public show_menu_klasy(id) { new text[513] format(text, 512, "yinfo Class - ^nw1. Sorcerer^nw2. Paladin^nw3. Monk^nw4. Barbarian^nw5. Assassin^nw6. Necromancer^nw7. Ninja^nw8. Hunter^n^nw0. Close") new keys keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<9) show_menu(id, keys, text) return PLUGIN_HANDLED } public klasy(id, key) { switch(key) { case 0: { mag(id) } case 1: { paladyn(id) } case 2: { mnich(id) } case 3: { barbarzynca(id) } case 4: { zabojca(id) } case 5: { nekromanta(id) } case 6: { ninja(id) } case 7: { Lowca(id) } case 9: { return PLUGIN_HANDLED } } return PLUGIN_HANDLED } public mag(id){ showitem(id,"Sorcerer"," "," "," Shooting from a pistol you freeze your opponent and take 5hp every 2 seconds for 15 seconds. Using your flashlight you are able to see invisible players ") } public paladyn(id){ showitem(id,"Paladin"," "," "," Starts with 125hp and can cast Long Jump. ") } public mnich(id){ showitem(id,"Monk"," "," "," You gain experiance faster Starts with 140hp ") } public barbarzynca(id){ showitem(id,"Barbarian"," "," "," Killing an enemy you recieve 200 armor and You recieve extra clips And regain extra hp. ") } public zabojca(id){ showitem(id,"Assassin"," "," "," You are unable to hear his footsteps and he is faster then other classes. When shooting a enemy with a pistol you eject them to mid air. ") } public nekromanta(id){ showitem(id,"Necromancer"," "," "," Attacking you damage 10hp more and can resurrect the dead. ") } public ninja(id){ showitem(id,"Ninja"," "," "," You are almost invisible and have 165hp to start with But is able only to use a knife. ") } public Lowca(id){ showitem(id,"Hunter"," "," "," Has a crossbow (take knife out and press reload) You can set up trap out of HE's(Change grenade mode with alternative fire) When shooting the enemy with a pistol, they leave a trail behind. ") }
[ Added: 20-04-2009, 23:39 ]
Hmm, how do i define Vaultkey and VaultData? and also the max_id_lenght? Sorry for the really nooby question.
#29
Napisano 20.04.2009 22:41
There are to many things that can go wrong in something this big so thats why i only can support only my work and some people that help me with it (and i know exacly what and where are made changes and I accept only working code to the next version)...
Hmm, how do i define Vaultkey and VaultData? and also the max_id_lenght? Sorry for the really nooby question.
key and data is a strin so simply:
new string[max_lenght]
but you have to remember to use always 1 less then in the stirn declaration (like new data[33] format(data,32,"xx") ).
Max players on server is 32 so max nubers of id declerated is 33 - all players_* is [33]
#30
Napisano 20.04.2009 22:45
#31
Napisano 20.04.2009 22:49
#32
Napisano 20.04.2009 22:51
#33
Napisano 20.04.2009 22:54
register_menucmd(register_menuid("Skill Menu"), 1023, "skill_menu")
register_menucmd(register_menuid("Class Info"), 1023, "klasy")
register_menucmd(register_menuid("Options"), 1023, "option_menu")
register_menucmd(register_menuid("Select Class"), 1023, "select_class_menu")
register_menucmd(register_menuid("Rune Shop"), 1023, "select_rune_menu")
register_menucmd(register_menuid("New Items"), 1023, "nowe_itemy")
this text need to be on front of the formated text but you translated it and now pluging can't find what you want to open
#34
Napisano 20.04.2009 22:56
#35
Napisano 20.04.2009 22:58
PS. It's 6 hour later by my then in new york so you can be shoure that i will pass out in some time soon
#36
Napisano 20.04.2009 23:00
Edit1: isnt the bold text, what i changed?
#37
Napisano 20.04.2009 23:08
register_menucmd(register_menuid("Class Info"), 1023, "klasy")
+
public show_menu_klasy(id)
{
new text[513]
format(text, 512, "yinfo Class - ^nw1. Sorcerer^nw2. Paladin^nw3. Monk^nw4. Barbarian^nw5. Assassin^nw6. Necromancer^nw7. Ninja^nw8. Hunter^n^nw0. Close")
new keys
keys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<9)
show_menu(id, keys, text)
return PLUGIN_HANDLED
}
something like that
here exactly do i place the new data? and the string thing? so they are defined.
plese define "data" there is to many in here and every time it meen someting else
You asked how to declarate a string so i writed how, it isn't neseserly needed or correct in your situation ;-)
#38
Napisano 20.04.2009 23:18
key and data is a strin so simply: new string[max_lenght] but you have to remember to use always 1 less then in the stirn declaration (like new data[33] format(data,32,"xx") ). Max players on server is 32 so max nubers of id declerated is 33 - all players_* is [33]
Where do i place all that?
because these are the errors.
/home/groups/amxmodx/tmp3/phpqTwuYH.sma(619) : error 017: undefined symbol "MAX_ID_LENGTH" /home/groups/amxmodx/tmp3/phpqTwuYH.sma(631) : error 017: undefined symbol "vaultkey" /home/groups/amxmodx/tmp3/phpqTwuYH.sma(631) : error 017: undefined symbol "vaultdata" /home/groups/amxmodx/tmp3/phpqTwuYH.sma(631) : warning 215: expression has no effect /home/groups/amxmodx/tmp3/phpqTwuYH.sma(631) : error 001: expected token: ";", but found ")" /home/groups/amxmodx/tmp3/phpqTwuYH.sma(631) : fatal error 107: too many error messages on one line Compilation aborted. 5 Errors.
[ Added: 21-04-2009, 00:19 ]
Refering to the top post. so i place each of those things before its public?
#39
Napisano 20.04.2009 23:22
new playerid[35]; get_user_authid(id,playerid,34); new vaultkey[64],vaultdata[256] format(vaultkey,63,"%s-%d-Dbmod",playerid,player_class[id])
MAX_ID_LENGTH - use real number that is max lenght or something...
#40
Napisano 20.04.2009 23:24
Użytkownicy przeglądający ten temat: 0
0 użytkowników, 0 gości, 0 anonimowych