VIP help
#1

hello guys how can i do if player is connected then the player is automatically become vip i used luxadmin

Code

dcmd_setvip(playerid,params[])
{
if(AccInfo[playerid][LoggedIn] == 1)
{
if(AccInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
{
new tmp [256];
new tmp2[256];
new Index;
tmp = strtok(params,Index);
tmp2 = strtok(params,Index);
if(!strlen(params)) return
SendClientMessage(playerid, LIGHTBLUE2, "Usage: /setvip [PlayerID] [AccountType (0-3)]") &&
SendClientMessage(playerid, orange, "Function: Will set the Account Type of the Specific Player (0-NormalAcc,1-Silver,2-Gold,3-Premium)");

new player1, type, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
player1 = strval(tmp);
if(!strlen(tmp2)) return
SendClientMessage(playerid, LIGHTBLUE2, "Usage: /setvip [PlayerID] [AccountType (0-3)]") &&
SendClientMessage(playerid, orange, "Function: Will set the Account Type of the Specific Player (1-Silver,2-Gold,3-Premium)");
type = strval(tmp2);

if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
{
if(AccInfo[player1][LoggedIn] == 1)
{
if(type > 3)
return SendClientMessage(playerid,red,"ERROR: Invalid Account Type!");
if(type == AccInfo[player1][pVip])
return SendClientMessage(playerid,red,"ERROR: Player is already have this Account Type!");
SendCommandToAdmins(playerid,"SetVip");
GetPlayerName(player1, playername, sizeof(playername));
GetPlayerName(playerid, adminname, sizeof(adminname));
new year,month,day;
new hour,minute,second;
getdate(year, month, day);
gettime(hour,minute,second);

switch(type)
{
case 1: AccType = "Silver";
case 2: AccType = "Gold";
case 3: AccType = "Premium";
}
if(type > 0)
format(string,sizeof(string),"|- Administrator %s has set your Account Type to: %s",adminname,AccType);
else
format(string,sizeof(string),"|- Administrator %s has set your Account Type to: 'Normal Account!",adminname);
SendClientMessage(player1,0x66C178AA,string);
if(type > AccInfo[player1][pVip])
GameTextForPlayer(player1,"Promoted", 2000, 3);
else GameTextForPlayer(player1,"Demoted", 2000, 3);

format(string,sizeof(string),"You have given %s Account Type: %s on '%d/%d/%d' at '%d:%d:%d'", playername, AccType, day, month, year, hour, minute, second);
SendClientMessage(playerid,0x00C378AA,string);
format(string,sizeof(string),"Administrator %s has made %s Account Type: %s",adminname, playername, AccType);
SaveIn("AdminLog",string);
dUserSetINT(PlayerName2(player1)).("AccountType",( type));
AccInfo[player1][pVip] = type;
return PlayerPlaySound(player1,1057,0.0,0.0,0.0);
}
else return SendClientMessage(playerid,red,"ERROR: This player is not Registred or Logged!");
}
else return ErrorMessages(playerid, 2);
}
else return ErrorMessages(playerid, 1);
}
else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}

please help
Reply
#2

You cannot keep copying code. You need to learn, goddamn it! That is so old and so slow (strtok) regarding speed, use ZCMD or something.
I will provide you the algorithm.
1) Find out what callback is called, when the player connects.
2) Find out what variable is used to set VIP level. (PlayerInfo[playerid][pVIP], and so on.)
3) Set it to 5 or whatever, under that callback.
4) Simple enough?
Reply
#3

Quote:
Originally Posted by emmaus09
Посмотреть сообщение
hello guys how can i do if player is connected then the player is automatically become vip i used luxadmin

please help
LuxAdmin saves the VIP doesn't it?
Reply
#4

Quote:

You cannot keep copying code. You need to learn, goddamn it!

im a beginner but i am willing to learn pawn don't insult me
Reply
#5

Quote:
Originally Posted by emmaus09
Посмотреть сообщение
im a beginner but i am willing to learn pawn don't insult me
If you are a begginer, you should begin by writing your own code. Of course you can download and play around with the scripts, but if you decide to climb the mountain the moment you learn to walk (I know, it's philosophical) you are going to fail. Start by writing simple snippets. Also, I wasn't insulting you, I was giving you advice, it's up to you on how to take it.
Reply
#6

wow rajat...PMS much? lol

anyway @ emm

I'd look under onplayerconnect and simply set the player variable for VIP there. However I'd personally suggest doing that during the player's login rather than the connect. Just keeps things a little tidier and makes sure all of the login checks don't interfere with the player's VIP Checks.
Reply
#7

Quote:
Originally Posted by CJay9209
Посмотреть сообщение
wow rajat...PMS much? lol

anyway @ emm

I'd look under onplayerconnect and simply set the player variable for VIP there. However I'd personally suggest doing that during the player's login rather than the connect. Just keeps things a little tidier and makes sure all of the login checks don't interfere with the player's VIP Checks.
Haah, I was giving constructive advice. If quoting something is emotional, alright, then I am.
Reply
#8

Hello guys Thank you for the advice Rajat_Pawar i download luxadmin to have admin system in my game mode i was scripting my gamemode myself i have a little bit experience on pawn. In lux admin it not the real because i edit it i add wearvip tag etc. i was challenging myself to finished my script before the school days im not an adult im just 12 years old and i wanted to learn about pawn. Again Tnx for the advice
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)