SA-MP Forums Archive
/buylevel is not respon - 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: /buylevel is not respon (/showthread.php?tid=631774)



/buylevel is not respon - Jihanz - 04.04.2017

can you help me about this
my command /buylevel
PHP код:
CMD:buylevel(playeridparams[])
{
    new 
str[50],pName[MAX_PLAYER_NAME],pID;
    new 
score GetPlayerScore(playerid);
    if(
TelahLogin[playerid]==0) return SCM(playerid,warna_merah,"kamu belum login");
    if(
PlayerInfo[playerid][pExp] <= ) return SendClientMessage(playerid,warna_biru,"Exp kamu belum cukup untuk melakukan command ini");
    if(
PlayerInfo[playerid][pExp] == 8) {
        
GivePlayerMoney(playerid, -6000);
        
PlayerInfo[playerid][pExp] = 0;
        
SetPlayerScore(playerid,score+1);
        
PlayerInfo[playerid][pLevel] += 1;
        
format(str,sizeof(str),"[INFO] : Selamat kepada %s telah membeli 1 score total scorenya adalah %i",pName,PlayerInfo[pID][pLevel]);
        
SendClientMessageToAll(warna_hijau,str);
    }
    return 
1;

why cannot respon please can you fix it ?


Thanks Before


Re: /buylevel is not respon - AndreiWow - 04.04.2017

Can you explain more please, I don't understand what is not working.


Re: /buylevel is not respon - CXdur - 04.04.2017

Are you only allowed to use the command at level 8? As far as I can see, this code does nothing for players that are over level 8? ( if(PlayerInfo[playerid][pExp] == { )

If not, that if clause isn't necessary at all since you have already checked if they're below it and returned for that.


Re: /buylevel is not respon - Vin Diesel - 04.04.2017

Try this.
Код:
CMD:buylevel(playerid, params[])
{
    new str[50],pName[MAX_PLAYER_NAME],pID;
    new score = GetPlayerScore(playerid);
    if(TelahLogin[playerid]==0) return SCM(playerid,warna_merah,"kamu belum login");
    if(PlayerInfo[playerid][pExp] <= 8 ) return SendClientMessage(playerid,warna_biru,"Exp kamu belum cukup untuk melakukan command ini");
        GivePlayerMoney(playerid, -6000);
        PlayerInfo[playerid][pExp] = 0;
        SetPlayerScore(playerid,score+1);
        PlayerInfo[playerid][pLevel] += 1;
        format(str,sizeof(str),"[INFO] : Selamat kepada %s telah membeli 1 score total scorenya adalah %i",pName,PlayerInfo[pID][pLevel]);
        SendClientMessageToAll(warna_hijau,str);
    }
    return 1;
}



Re: /buylevel is not respon - Jihanz - 05.04.2017

Quote:
Originally Posted by Vin Diesel
Посмотреть сообщение
Try this.
Код:
CMD:buylevel(playerid, params[])
{
    new str[50],pName[MAX_PLAYER_NAME],pID;
    new score = GetPlayerScore(playerid);
    if(TelahLogin[playerid]==0) return SCM(playerid,warna_merah,"kamu belum login");
    if(PlayerInfo[playerid][pExp] <= 8 ) return SendClientMessage(playerid,warna_biru,"Exp kamu belum cukup untuk melakukan command ini");
        GivePlayerMoney(playerid, -6000);
        PlayerInfo[playerid][pExp] = 0;
        SetPlayerScore(playerid,score+1);
        PlayerInfo[playerid][pLevel] += 1;
        format(str,sizeof(str),"[INFO] : Selamat kepada %s telah membeli 1 score total scorenya adalah %i",pName,PlayerInfo[pID][pLevel]);
        SendClientMessageToAll(warna_hijau,str);
    }
    return 1;
}
its working thanks bro +rep


Re: /buylevel is not respon - Vin Diesel - 05.04.2017

You're welcome.