Raised This Month: $ Target: $400
 0% 

WC3 addon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pulpy
Senior Member
Join Date: Oct 2005
Location: Brights Grove, ON
Old 10-17-2005 , 02:37   WC3 addon
Reply With Quote #1

hi, im wondering if someone can tell me how to add wc3_setxp <playername> <xp> it alrdy has wc3_givexp <playername> <xp> (gives the player xp and adds it to their current). But i'd like to be able to set ppl xp. So say someone has like 1000 xp. And i want them to have 564123xp. Instead of doing all the math to figure out how much to add, all i have to do is type in wc3_setxp <name> 564123 and they have that much. So it wont add but just sets it, then they can continue gaining/losing xp (depends on wat they do). I have no clue how to script so maybe if someone can edit the file and link me to it or something then i can add it and have setxp.
heres link http://forums.alliedmods.net/showthread.php?p=129465

Also just a side question. If i were to give someone admin, but i didnt want to allow them access to wc3 commands, how do i find out what flag set wc3 is set as? That way if they get full admin - minus access to wc3 commands i would know what flags they get. I dont know anything bout coding so if someone can like maybe add it to the sma and then either compile it or let me compile it then that would be great.

This wont erase my vault.ini file right? And i would only have to re-add the .amxx file right and it will work right?

lol, another one to haha. Im having problems with the set level. I set it to 2. Meaning when someon joins the server they start at lvl 2, but this isnt happening, ppl join with 0xp and hafta work their way up. Instead of joining at lvl 2 with 200xp. If someone can help clear this up great

Anyways thanks alot in advance!
__________________
pulpy is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-17-2005 , 16:47  
Reply With Quote #2

Put this anywhere in the file:

Code:
public wc3_setxp(id,level,cid) {     if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED     if(!warcraft3)     {         console_print(id,"[WC3] The Warcraft3 Mod is currently disabled.")         return PLUGIN_HANDLED     }         new sArgPlayer[32]     read_argv(1,sArgPlayer,31)     new sArgAmount[32]     read_argv(2,sArgAmount,31)     new xp = str_to_num(sArgAmount)     new player = cmd_target(id,sArgPlayer,2)     if(!player) return PLUGIN_HANDLED         new name[32]; get_user_name(player,name,31)     new name2[32]; get_user_name(id,name2,31)     playerxp[player] = xp     displaylevel(player,1)     console_print(id,"[WC3] You set %s's xp to %d.",name,xp)             return PLUGIN_HANDLED }

Put this in plugin_init:

Code:
register_concmd("wc3_setxp","wc3_setxp",ADMIN_RCON,"<name or #userid> <xp>")

Both wc3_setxp an wc3_givexp require the rcon access flag, so just don't give that to your other admins.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
pulpy
Senior Member
Join Date: Oct 2005
Location: Brights Grove, ON
Old 10-17-2005 , 18:26  
Reply With Quote #3

thank you, where bouts is the plugin_init? or is that inside the sma?

edit: also thx for the code avalanche +karma
__________________
pulpy is offline
nightscreem
Veteran Member
Join Date: Jul 2004
Location: Belgium
Old 10-17-2005 , 18:40  
Reply With Quote #4

the register_concmd you should put in warcraft3.sma
and the public wc3_setxp...
you can put also in warcraft3.sma
then compile the warcraft3.sma with the compiler in you scripting folder

open the folder compiled located in the scripting folder
and move the warcraft3.amxx to plugins folder and overwrite it with the old one and you are done
__________________
- Bye bye!
nightscreem is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-17-2005 , 18:48  
Reply With Quote #5

Quote:
Originally Posted by pulpy
thank you, where bouts is the plugin_init? or is that inside the sma?
plugin_init is a function inside of the .sma, open it up and search for "public plugin_init".
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
pulpy
Senior Member
Join Date: Oct 2005
Location: Brights Grove, ON
Old 10-17-2005 , 20:29  
Reply With Quote #6

heh i din search for it but i scrolled through it and put it below the text:

register_concmd("wc3_givexp","wc3_givexp",ADM IN_RCON,"<name or #userid> <xp>")
register_concmd("wc3_setxp","wc3_setxp",ADMIN _RCON,"<name or #userid> <xp>")

so thats wat it says.

Also with the setxp i didnt know if i would break any code, so i went to the bottom and put this: (i added the convert_to_vault code so if i did it wrong and its mixing with that, then you can tell. Its right at the end of the code i put it though, im pretty sure i got it right. lol and i added comments for myself incase i screwed something up :p thanks abunch guys!

#if CONVERT_TO_VAULT
public convert_to_vault()
{

new index[32], vaultkey[64], vaultdata[128], playerid[32], playername[MAX_NAME_LENGTH]
new textline[128], nextline, textlength
new xp[8], race[2], skill1[2], skill2[2], skill3[2], skill4[2]
new month[3], day[3]

new timeseed, newtime
new currentmonth[3], currentday[3], currentyear[5]
new daysinmonth[12] = {31,28,31,30,31,30,31,31,30,31,30,31}

get_time("%d",currentday,2)
get_time("%m",currentmonth,2)
get_time("%y",currentyear,4)
format(currentyear,4,"20%s",currentyear)

// We know there's been 8 leapyears since 1970 to 2004 (Its 2005 now)
timeseed = (str_to_num(currentyear)-1979) * 31536000
timeseed += 252979200

if(file_exists(XPFILENAME))
{
server_print("[WC3] Old saved xp file found. Converting to VAULT...")

do
{
nextline = read_file(XPFILENAME,nextline,textline,127,te xtlength)

if(textlength && contain(textline,"**") && contain(textline,"##"))
{

parse(textline,playerid,31,playername,MAX_NAM E_LENGTH-1,xp,7,race,1,skill1,1,skill2,1,skill3,1,skil l4,1,month,2,day,2)

format(vaultkey,63,"WC3_%s_%s",playerid,race)


#if VAULT_PROTECT // If we're protecting the Vault, check if the key exists first.
if(!vaultdata_exists(vaultkey))
{
#endif

format(vaultdata, 127, "%s %s %s %s %s %s",xp,race,skill1,skill2,skill3,skill4)
set_vaultdata(vaultkey,vaultdata)

#if VAULT_PROTECT
}
#endif

newtime = str_to_num(day)
for(new i=1; i < str_to_num(month); i++)
newtime += daysinmonth[i-1]

newtime = (newtime*86400)+timeseed

if(str_to_num(month) < str_to_num(currentmonth) || (str_to_num(month) == str_to_num(currentmonth) && str_to_num(day) < str_to_num(currentday)))
{
newtime += 31536000
// I seriously doubt we need to worry about leapyears past 2008, but we'll check for 2012 to be silly.
if(str_to_num(currentyear)-1 == 2004 || str_to_num(currentyear)-1 == 2008 || str_to_num(currentyear)-1 == 2012)
newtime += 86400
}

format(vaultkey, 63, "WC3_%s", playerid)

if(!vaultdata_exists(vaultkey))
{
get_vaultdata("WC3_war3index", index, 31);
format(vaultdata,127,"%s ^"%s^" %d",index,playername,newtime)
set_vaultdata(vaultkey,vaultdata)
format(vaultkey,63,"WC3_pruneindex_%s",index)
set_vaultdata(vaultkey,playerid)
format(index,31,"%d",(str_to_num(index)+1))
set_vaultdata("WC3_war3index",index)
}
#if !VAULT_PROTECT // If we're protecting the vault, leave the current key alone.
else
{
new sOldTime[32]
get_vaultdata(vaultkey,vaultdata,127)
parse(vaultdata,index,31,playername,MAX_NAME_ LENGTH-1,sOldTime,31)

if(str_to_num(sOldTime) > newtime)
newtime = str_to_num(sOldTime)

format(vaultdata,127,"%s ^"%s^" %d",index,playername,newtime)
set_vaultdata(vaultkey,vaultdata)
}
#endif
}

write_file("war3users.bak",textline,-1)
write_file(XPFILENAME,"",nextline-1)

} while (nextline)

delete_file(XPFILENAME)

server_print("[WC3] Conversion completed.")
}

return PLUGIN_CONTINUE
}

//I added this. setting xp.
public wc3_setxp(id,level,cid)
{
if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
if(!warcraft3)
{
console_print(id,"[WC3] The Warcraft3 Mod is currently disabled.")
return PLUGIN_HANDLED
}

new sArgPlayer[32]
read_argv(1,sArgPlayer,31)
new sArgAmount[32]
read_argv(2,sArgAmount,31)

new xp = str_to_num(sArgAmount)

new player = cmd_target(id,sArgPlayer,2)
if(!player) return PLUGIN_HANDLED

new name[32]; get_user_name(player,name,31)
new name2[32]; get_user_name(id,name2,31)
playerxp[player] = xp
displaylevel(player,1)
console_print(id,"[WC3] You set %s's xp to %d.",name,xp)

return PLUGIN_HANDLED
}
//ended what i added. any probs remove anything between these comments.

#endif
#endif
__________________
pulpy is offline
pulpy
Senior Member
Join Date: Oct 2005
Location: Brights Grove, ON
Old 10-17-2005 , 21:01  
Reply With Quote #7

im double posting so that ppl dont get confused between this and that, if i should just edit just tell me.

Anyways im getting a compiling error. this is what it says

Welcome to the AMX Mod X 1.60-300 Compiler.
Copyright (c) 1997-2005 ITB CompuPhase, AMX Mod X Team

/home/users/amxmodx/tmp3/phpOxmJuA.sma(61) : fatal error 100: cannot read from file: "warcraft3.cfg"

Compilation aborted.
1 Error.
Could not locate output file /home/groups/amxmodx/public_html/websc3/phpOxmJuA.amx (compile failed).

Im not sure what i did wrong, so any help would be great

Edit: Im actually thinking it may be getting this error, cause i had opened it in wordpad, but when i went to save it, it was telling me i would lose certain things (cant remember wat it said), so i saved it as a richtextfile, then renamed it to .sma, i've allowed myself to see file extensions on all my files, so the actual file is called warcraft3.sma, not warcraft.sma.rtf. Anyways its more then likly this prob im guessing, so a question is now, how do i save it as a sma without having to rename it like this?

Oh, the error was this: "you are about to save this file in a text only format, which will remove all formatting. Are you sure you want to do this?" I clicked no and found that rtf format didnt ask this.



Edit: What i've changed is the default start level (lvl2 now) and added those scripts above. So i dunno maybe if someone can create a sma file that will compile that would be great. Or you can tell me what im doing wrong so i can compile the one i got. thanks again


Second Edit: Turns out the original file dusnt even compile correctly... so any help here would be great sry for these long ass posts and the double posts and all the edits lol
__________________
pulpy is offline
AngryMouse
Junior Member
Join Date: Feb 2005
Location: Darwin, Australia
Old 10-31-2005 , 11:09  
Reply With Quote #8

With this mod you have to put both the warcraft3.sma and warcraft3.cfg in the scripting folder together from memory. Try that and see what happens.
__________________
AngryMouse is offline
Send a message via ICQ to AngryMouse Send a message via MSN to AngryMouse
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 23:45.


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