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 , 20:29  
Reply With Quote #1

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
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