SA-MP Forums Archive
Need help - 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: Need help (/showthread.php?tid=280454)



Need help - leingod - 01.09.2011

Hello can someone show me the code how to fix the stock [maxexplvl]

Код:
public OnPlayerUpdate(playerid)
{
	new string[256];
	SetPlayerScore(playerid, GetPlayerLevel(playerid));

	if(GetPlayerExp(playerid) >= maxexplvl)
	{
		GivePlayerLevel(playerid, 1);
	   	format(string, sizeof(string), "*  Congratulations! Your char id had ben increased level to {FFFFFF}-> %d", GetPlayerLevel(playerid));
	   	SendClientMessage(playerid, 0xCCFF00BB, string);
     	GivePlayerExp(playerid, - 1000);
	}
	return 1;
}
maxexplvl function is when it (getplayerlevel, 1) the value of maxexplvl is 1000 then if (getplayerlevel, 2) the value of maxexplvl is 2000 can you guys help me to create the callback code?

i don't know how.. are it look like this?
Код:
stock maxexplvl(playerid)
{
	if(GetPlayerLevel(playerid, 1) return maxexplvl(1000)
}



Re: Need help - =WoR=Varth - 01.09.2011

pawn Код:
stock maxexplvl(playerid)
{
    switch(GetPlayerLevel(playerid))
    {
        case 0://Player level is 0
        case 1://Player level is 1
        case 2://And so on
    }
    return 1;
}



Re: Need help - FireCat - 01.09.2011

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
pawn Код:
stock maxexplvl(playerid)
{
    switch(GetPlayerLevel(playerid))
    {
        case 0://Player level is 0
        case 1://Player level is 1
        case 2://And so on
    }
    return 1;
}
He still can do if statement.
pawn Код:
stock maxexplvl(playerid)
{
    if(GetPlayerLevel(playerid, 1) return 1000;
        return 1;
}



Re: Need help - leingod - 01.09.2011

Im confused here..


Re: Need help - =WoR=Varth - 01.09.2011

Quote:
Originally Posted by FireCat
Посмотреть сообщение
He still can do if statement.
pawn Код:
stock maxexplvl(playerid)
{
    if(GetPlayerLevel(playerid, 1) return 1000;
        return 1;
}
But switch is faster.


Re: Need help - FireCat - 01.09.2011

Quote:
Originally Posted by leingod
Посмотреть сообщение
Im confused here..
Try using both.
But mine is already "made" with 1000.
Just copy and paste for the level you want like
if(GetPlayerLevel(playerid,2)) return 2000;


Re: Need help - leingod - 01.09.2011

Код:
C:\blabla.pwn(1460) : error 076: syntax error in the expression, or invalid function call
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: Need help - =WoR=Varth - 01.09.2011

Kalo mau lebih cepet pake switch gan, kalo bingung caranya tanya aja. Namanya juga tempat diskusi.


Re: Need help - leingod - 01.09.2011

Pasang value 1000 nya dmn? kalo pake switch


Re: Need help - =WoR=Varth - 01.09.2011

pawn Код:
stock maxexplvl(playerid)
{
    switch(GetPlayerLevel(playerid))
    {
        case 1: return 1000;//Kalo Level player 1, max level jadi 1000
        case 2: return 2000;//Kalo Level player 2, max level jadi 2000
    }
    return 1;
}
Di OPU agan, maxexplv nya salah.
pawn Код:
public OnPlayerUpdate(playerid)
{
    new string[256];
    SetPlayerScore(playerid, GetPlayerLevel(playerid));

    if(GetPlayerExp(playerid) >= maxexplvl(playerid))//Pake playerid soalnya di stock agan butuh 1 argument
    {
        GivePlayerLevel(playerid, 1);
        format(string, sizeof(string), "*  Congratulations! Your char id had ben increased level to {FFFFFF}-> %d", GetPlayerLevel(playerid));
        SendClientMessage(playerid, 0xCCFF00BB, string);
        GivePlayerExp(playerid, - 1000);
    }
    return 1;
}