#1

How do I create an order /levelbonus , anyone can use to enter the server and receive level 3 + 1.000.000$ ?
Reply
#2

can u explain a bit more ?
Reply
#3

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 ?
Reply
#4

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.
Reply
#5

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"
Reply
#6

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]);
Reply
#7

PHP код:
new bool:bonusUsed[MAX_PLAYERS] = false;
CMD:levelbonus(playeridparams[])
{
    
#pragma unused params
    
if(bonusUsed[playerid]) return SCM(playerid, -1"You've already used your level bonus.");
    
SetPlayerScore(playeridGetPlayerScore(playerid) + 3);
    
GivePlayerMoney(playerid1000000);
    
bonusUsed[playerid] = true;
    return 
SCM(playerid, -1"You've used your levelbonus ! You've gotten 3 levels more and $1'000'000 !");

Reply
#8

Thanks. Resolved!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)