How to create /setvip cmd for rcon in zcmd
#1

hi guys , i want to create the commands /setvip for rcon , Vips levels are betwen 1 and 3 ,
and i want it to register files in scriptfiles/Users
and thanks
Reply
#2

May it can help you




Код:
CMD: setdonator(playerid, params[]) {
	if(PlayerInfo[playerid][pAdmin] >= 6) {
		new string[128], giveplayerid, level;
		if(sscanf(params, "ud", giveplayerid, level)) {
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setdonator [player] [level]");
			SendClientMessage(playerid, COLOR_GRAD3, "Available Levels: |0| None |1| Pearl Donator |2| Emerald Donator |3| Diamond Donator");
			return 1;
		}

		if(IsPlayerConnected(giveplayerid))
		{
			if(giveplayerid != INVALID_PLAYER_ID)
			{
				if(level < 0 || level > 3)
				{
					SendClientMessage(playerid, COLOR_GRAD1, "Donator Level can't be below 0 or above 3!");
					return 1;
				}
				PlayerInfo[giveplayerid][pDonator] = level;
				new playerip[32];
				GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
				if(level == 0)
				{
					format(string, sizeof(string), "AdmCmd: %s has set %s's donator level to None (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
					ABroadCast(COLOR_LIGHTRED,string, 4);
					format(string, sizeof(string), "Your donator level has been set to None by Admin %s.", GetPlayerNameEx(playerid));
					SendClientMessage(giveplayerid, COLOR_WHITE, string);

					format(string, sizeof(string), "AdmCmd: %s has set %s's (IP:%s) donator level to None (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), playerip, level);
					Log("logs/setvip.log", string);
					return 1;
				}
				if(level == 1)
				{
				    PlayerInfo[giveplayerid][pDonatorExpire] = gettime()+2592000;
					format(string, sizeof(string), "AdmCmd: %s has set %s's donator level to Pearl Donator (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
					ABroadCast(COLOR_LIGHTRED,string, 4);
					format(string, sizeof(string), "Your donator level has been set to Pearl Donator by Admin %s.", GetPlayerNameEx(playerid));
					SendClientMessage(giveplayerid, COLOR_WHITE, string);

					format(string, sizeof(string), "AdmCmd: %s has set %s's (IP:%s) donator level to Pearl Donator (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), playerip, level);
					Log("logs/setvip.log", string);
					return 1;
				}
				if(level == 2)
				{
				    PlayerInfo[giveplayerid][pDonatorExpire] = gettime()+2592000;
					format(string, sizeof(string), "AdmCmd: %s has set %s's donator level to Emerald Donator (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
					ABroadCast(COLOR_LIGHTRED,string, 4);
					format(string, sizeof(string), "Your donator level has been set to Emerald Donator by Admin %s.", GetPlayerNameEx(playerid));
					SendClientMessage(giveplayerid, COLOR_WHITE, string);

					format(string, sizeof(string), "AdmCmd: %s has set %s's (IP:%s) donator level to Emerald Donator (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), playerip, level);
					Log("logs/setvip.log", string);
					return 1;
				}
				if(level == 3)
				{
				    PlayerInfo[giveplayerid][pDonatorExpire] = gettime()+2592000;
					format(string, sizeof(string), "AdmCmd: %s has set %s's donator level to Diamond Donator (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
					ABroadCast(COLOR_LIGHTRED,string, 4);
					format(string, sizeof(string), "Your donator level has been set to Diamond Donator by Admin %s.", GetPlayerNameEx(playerid));
					SendClientMessage(giveplayerid, COLOR_WHITE, string);

					format(string, sizeof(string), "AdmCmd: %s has set %s's (IP:%s) donator level to Diamond Donator (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), playerip, level);
					Log("logs/setvip.log", string);
					return 1;
				}
			}
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
	}
	return 1;
}
Reply
#3

This is not for rcon , and does that register on scriptfiles/users,
Reply
#4

https://sampforum.blast.hk/showthread.php?tid=273088
Reply
#5

Im not searching for "Login and Register System - "
Reply
#6

Quote:
Originally Posted by XaibBaba
Посмотреть сообщение
May it can help you




Код:
CMD: setdonator(playerid, params[]) {
	if(PlayerInfo[playerid][pAdmin] >= 6) {
		new string[128], giveplayerid, level;
		if(sscanf(params, "ud", giveplayerid, level)) {
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setdonator [player] [level]");
			SendClientMessage(playerid, COLOR_GRAD3, "Available Levels: |0| None |1| Pearl Donator |2| Emerald Donator |3| Diamond Donator");
			return 1;
		}

		if(IsPlayerConnected(giveplayerid))
		{
			if(giveplayerid != INVALID_PLAYER_ID)
			{
				if(level < 0 || level > 3)
				{
					SendClientMessage(playerid, COLOR_GRAD1, "Donator Level can't be below 0 or above 3!");
					return 1;
				}
				PlayerInfo[giveplayerid][pDonator] = level;
				new playerip[32];
				GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
				if(level == 0)
				{
					format(string, sizeof(string), "AdmCmd: %s has set %s's donator level to None (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
					ABroadCast(COLOR_LIGHTRED,string, 4);
					format(string, sizeof(string), "Your donator level has been set to None by Admin %s.", GetPlayerNameEx(playerid));
					SendClientMessage(giveplayerid, COLOR_WHITE, string);

					format(string, sizeof(string), "AdmCmd: %s has set %s's (IP:%s) donator level to None (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), playerip, level);
					Log("logs/setvip.log", string);
					return 1;
				}
				if(level == 1)
				{
				    PlayerInfo[giveplayerid][pDonatorExpire] = gettime()+2592000;
					format(string, sizeof(string), "AdmCmd: %s has set %s's donator level to Pearl Donator (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
					ABroadCast(COLOR_LIGHTRED,string, 4);
					format(string, sizeof(string), "Your donator level has been set to Pearl Donator by Admin %s.", GetPlayerNameEx(playerid));
					SendClientMessage(giveplayerid, COLOR_WHITE, string);

					format(string, sizeof(string), "AdmCmd: %s has set %s's (IP:%s) donator level to Pearl Donator (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), playerip, level);
					Log("logs/setvip.log", string);
					return 1;
				}
				if(level == 2)
				{
				    PlayerInfo[giveplayerid][pDonatorExpire] = gettime()+2592000;
					format(string, sizeof(string), "AdmCmd: %s has set %s's donator level to Emerald Donator (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
					ABroadCast(COLOR_LIGHTRED,string, 4);
					format(string, sizeof(string), "Your donator level has been set to Emerald Donator by Admin %s.", GetPlayerNameEx(playerid));
					SendClientMessage(giveplayerid, COLOR_WHITE, string);

					format(string, sizeof(string), "AdmCmd: %s has set %s's (IP:%s) donator level to Emerald Donator (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), playerip, level);
					Log("logs/setvip.log", string);
					return 1;
				}
				if(level == 3)
				{
				    PlayerInfo[giveplayerid][pDonatorExpire] = gettime()+2592000;
					format(string, sizeof(string), "AdmCmd: %s has set %s's donator level to Diamond Donator (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), level);
					ABroadCast(COLOR_LIGHTRED,string, 4);
					format(string, sizeof(string), "Your donator level has been set to Diamond Donator by Admin %s.", GetPlayerNameEx(playerid));
					SendClientMessage(giveplayerid, COLOR_WHITE, string);

					format(string, sizeof(string), "AdmCmd: %s has set %s's (IP:%s) donator level to Diamond Donator (%d).", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), playerip, level);
					Log("logs/setvip.log", string);
					return 1;
				}
			}
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
	}
	return 1;
}
Then use this code, and modify it. You already got the help you asked for.
Reply
#7

Код:
CMD:setvip(playerid,params[])
{
	if(IsPlayerAdmin(playerid))
	{
	    new id;
		if(sscanf(params,"ui",id)) return SendClientMessage(playerid,0xFF0000AA,"Usage: /setvip [PlayerID]");
		if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid,0xFF0000AA,"This player is not connected!");
		if(AccInfo[id][Vip] == 1) return SendClientMessage(playerid,0xFF0000AA,"This player is already this vip level.");
		new string[1000];
		format(string,sizeof(string),"Administrator %s has set you the vip Account",GetName(playerid));
		SendClientMessage(id,0x00FF00AA,string);
		AccInfo[id][Vip] = 1;
	}
	else return SendClientMessage(playerid,0xFF0000AA,"You are not highest level to use this command.");
	return 1;
}
Код:
CMD:removevip(playerid,params[])
{
	if(IsPlayerAdmin(playerid))
	{
	    new id;
		if(sscanf(params,"ui",id)) return SendClientMessage(playerid,0xFF0000AA,"Usage: /removevip [PlayerID]");
		if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid,0xFF0000AA,"This player is not connected!");
		if(AccInfo[id][Vip] == 0) return SendClientMessage(playerid,0xFF0000AA,"This player isn't a VIP.");
		new string[1000];
		format(string,sizeof(string),"Administrator %s has removed your vip Account",GetName(playerid));
		SendClientMessage(id,0x00FF00AA,string);
		AccInfo[id][Vip] = 0;
	}
	else return SendClientMessage(playerid,0xFF0000AA,"You are not highest level to use this command.");
	return 1;
}
Reply
#8

add this in your enum (the enum for the register/login)
Код:
enum pInfo
{
      pVIP
}
new PlayerInfo[MAX_PLAYERS][pInfo];
then add this command
Код:
CMD:makevip(playerid,params[])
{
 	if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,COL_RED,"<!>You are not authorized to use this command!");
 	new pID,pmsg[128],adminmsg[128];
 	if(sscanf(params,"u",pID))return SendClientMessage(playerid,COL_GREEN,"/makevip [id]");
 	format(adminmsg,sizeof(adminmsg),"You've promoted %s to a VIP member",PlayerName(pID));
 	format(pmsg,sizeof(pmsg),"You've been promoted to a VIP member by Adminstrator %s",PlayerName(playerid));
 	SetPVarInt(pID,"VIP",1);
 	PlayerInfo[pID][pVIP] = 1;
 	SendClientMessage(playerid,COL_LIGHTBLUE,adminmsg);
 	SendClientMessage(playerid,COL_LIGHTBLUE,pmsg);
 	return 1;
}
add this stock at the bottom
Код:
stock IsPlayerVIP(playerid,Rang)
{
	if(GetPVarInt(playerid,"VIP")>=Rang)return 1;
	return 0;
}
tell me if something goes wrong
Reply
#9

Quote:
Originally Posted by YuKki1
Посмотреть сообщение
Im not searching for "Login and Register System - "
I've given you that link to see how to work with Y_ini :/
Reply
#10

Okay thanks evrybody im going to try it tmw
+rep for all who helped
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)