SA-MP Forums Archive
Respect - problem! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Respect - problem! (/showthread.php?tid=382617)



Respect - problem! - Akcent_Voltaj - 04.10.2012

i buy level and the respect gets set to 0 ..what can i do?


PHP код:
if (strcmp(cmd"/buylevel"true) == 0)
                    {
                    if(
IsPlayerConnected(playerid))
                    {
                    if (
gPlayerLogged[playerid] != 0)
                    {
                        
PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
                        if(
PlayerInfo[playerid][pLevel] >= 0)
                        {
                            new 
nxtlevel PlayerInfo[playerid][pLevel]+1;
                            new 
costlevel nxtlevel*levelcost;//10k for testing purposes
                            
new expamount nxtlevel*levelexp;
                            new 
infostring[256];
                            if(
GetPlayerCash(playerid) < costlevel)
                            {
                                
format(infostring256"   You do not have enough Cash (%dLei) !",costlevel);
                                
SendClientMessage(playeridCOLOR_GRAD1infostring);
                                return 
1;
                            }
                            else if (
PlayerInfo[playerid][pExp] < expamount)
                            {
                                
format(infostring256"   You need %d Respect Points, you curently have [%d] !",expamount,PlayerInfo[playerid][pExp]);
                                
SendClientMessage(playeridCOLOR_GRAD1infostring);
                                return 
1;
                            }
                            else
                            {
                                
format(stringsizeof(string), "~g~LEVEL UP~n~~w~You Are Now Level %d"nxtlevel);
                                
PlayerPlaySound(playerid10520.00.00.0);
                                
PlayerPlayMusic(playerid);
                                
GivePlayerCash(playerid, (-costlevel));
                                
PlayerInfo[playerid][pLevel]++;
                                if(
PlayerInfo[playerid][pDonateRank] > 0)
                                {
                                    
PlayerInfo[playerid][pExp] -= expamount;
                                    new 
total PlayerInfo[playerid][pExp];
                                    if(
total 0)
                                    {
                                        
PlayerInfo[playerid][pExp] = total;
                                    }
                                    else
                                    {
                                        
PlayerInfo[playerid][pExp] = 0;
                                    }
                                }
                                
PlayerInfo[playerid][gPupgrade] = PlayerInfo[playerid][gPupgrade]+2;
                                
GameTextForPlayer(playeridstring50001);
                                
format(infostring256"   You bought Level %d for (%dLei) Type /upgrade"nxtlevelcostlevel);
                                
SendClientMessage(playeridCOLOR_GRAD1infostring);
                                
format(infostring256"   You gave %d unspent Upgrade Points",PlayerInfo[playerid][gPupgrade]);
                                
SendClientMessage(playeridCOLOR_GRAD2infostring);
                            }
                        }
                        return 
1;
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_GRAD1"   You are not Logged in !");
                    }
                    }
                    return 
1;
                    } 



Re: Respect - problem! - Roel - 04.10.2012

Whats wrong? you don't want to reset it after he bought a level?
Normaly it should get reset with this kind of systems I think, so tell me what you want.


Re: Respect - problem! - CmZxC - 04.10.2012

Quote:
Originally Posted by Roel
Посмотреть сообщение
Whats wrong? you don't want to reset it after he bought a level?
Normaly it should get reset with this kind of systems I think, so tell me what you want.
That man is correct, respect is spent on buying level aswell with money.

If you want to keep the respect, remove this:

pawn Код:
PlayerInfo[playerid][pExp] -= expamount;
if(total > 0)
{
    PlayerInfo[playerid][pExp] = total;
}
else
{
    PlayerInfo[playerid][pExp] = 0;
}



Re: Respect - problem! - Akcent_Voltaj - 04.10.2012

no but i stay 30/40 hours i buy level and reset..i dont want that..if i have 30/40 so thats minus 30-40=10..then it should be 30/..


Re: Respect - problem! - Akcent_Voltaj - 04.10.2012

anyone know??or have?


Re: Respect - problem! - Akcent_Voltaj - 04.10.2012

help pleaseeee