This is my script level up (from dungeon fighter mod)
I know about setweap, but i dont know how to insert the setweap inthe script lines to works.
It works together another scripts, but this one looks like the main script.
lvup.c
void lvup(int plIndex)
{
void score=getplayerproperty(plIndex,"score");
void ent=getplayerproperty(plIndex,"entity");
int oldLevel=getglobalvar("level."+plIndex);
int lv=getLevel(score);
if (oldLevel==NULL()){oldLevel=1;}
if (lv>oldLevel){
setAbi(plIndex,ent);
spawnLvup(ent);
}
setglobalvar("score"+plIndex,score);
}
void spawnLvup(void ent)
{
clearspawnentry();
setspawnentry("name", "levelup");
void vSpawn=spawn();
float fX =getentityproperty(ent, "x");
float fY = getentityproperty(ent, "a");
float fZ = getentityproperty(ent, "z");
changeentityproperty(vSpawn, "position", fX, fZ, fY + 1);
}
void setAbi(void plIndex,void ent)
{
void score=getplayerproperty(plIndex,"score");
void lv=getLevel(score);
changeentityproperty(ent,"maxhealth",getentityproperty(ent,"maxhealth")+2*(lv - 1));
changeentityproperty(ent,"maxmp",getentityproperty(ent,"maxmp")+2*(lv - 1));
changeentityproperty(ent,"health",getentityproperty(ent,"maxhealth"));
changeentityproperty(ent,"mp",getentityproperty(ent,"maxmp"));
setglobalvar("level."+plIndex,lv);
}
int getLevel(void score)
{
int lv;
if(score>2200000){
lv=20;
}else if(score>1980000){
lv=19;
}else if(score>1760000){
lv=18;
}else if(score>1540000){
lv=17;
}else if(score>1320000){
lv=16;
}else if(score>1100000){
lv=15;
}else if(score>880000){
lv=14;
}else if(score>660000){
lv=13;
}else if(score>440000){
lv=12;
}else if(score>220000){
lv=11;
}else if(score>160000){
lv=10;
}else if(score>110000){
lv=9;
}else if(score>70000){
lv=8;
}else if(score>40000){
lv=7;
}else if(score>20000){
lv=6;
}else if(score>10000){
lv=5;
}else if(score>5000){
lv=4;
}else if(score>2500){
lv=3;
}else if(score>1250){
lv=2;
}else{
lv=1;
}
return lv;
}
void getPlLevel(int plIndex)
{
void ent=getplayerproperty(plIndex,"entity");
if (!ent){return;}else{}
void score=getplayerproperty(plIndex,"score");