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: Help? (
/showthread.php?tid=514795)
Help? -
Madalyinn - 23.05.2014
How do I create an order /levelbonus , anyone can use to enter the server and receive level 3 + 1.000.000$ ?
Re: Help? -
Vaishnav - 23.05.2014
can u explain a bit more ?
Re: Help? -
Fred1993 - 23.05.2014
you mean how to create a command "/levelbonus" ?
anyone who connects the server and type the command will get level 3 and $1,000,000 on his hand ?
Re: Help? -
Madalyinn - 23.05.2014
to create a command /levelbonus, and when the players enter the server use the command /levelbonus and receive level 3 and 1.000.000$.
yes fred.
Re: Help? -
Fred1993 - 23.05.2014
pawn Код:
CMD:levelbonus(playerid,params[])
{
// you can use if condition here so players can use the command only once.
GivePlayerMoney(playerid, 1000000); // this will give the money
SetPlayerScore(playerid, 3); // this will set the score
return 1;
}
This command is for zcmd.. you can change it to ycmd or maybe you can us it under "onplayercommandtext"
Re: Help? -
Rittik - 23.05.2014
Create an enum
Код:
enum pInfo
{
pLevel,
pCash
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Код:
CMD:levelbonus(playerid,params[])
{
if(PlayerInfo[playerid][pLevel]==3)
{
SendClientMessage(playerid,-1,"You already have Level 3 and 1,000,000$");
return 1;
}
else
{
PlayerInfo[playerid][pLevel]=3;
GivePlayerMoney(playerid,1000000);
PlayerInfo[playerid][pCash]=GetPlayerMoney(playerid);
}
return 1;
}
Under OnPlayerDisconnect
Код:
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
INI_Close(File);
return 1;
}
Under OnPlayerConnect
Код:
GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);
Re : Help? -
S4t3K - 23.05.2014
PHP код:
new bool:bonusUsed[MAX_PLAYERS] = false;
CMD:levelbonus(playerid, params[])
{
#pragma unused params
if(bonusUsed[playerid]) return SCM(playerid, -1, "You've already used your level bonus.");
SetPlayerScore(playerid, GetPlayerScore(playerid) + 3);
GivePlayerMoney(playerid, 1000000);
bonusUsed[playerid] = true;
return SCM(playerid, -1, "You've used your levelbonus ! You've gotten 3 levels more and $1'000'000 !");
}
Re: Help? -
Madalyinn - 23.05.2014
Thanks. Resolved!