All pastes #813112 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-12-12 08:06 UTC
rendered paste body
enum PLAYER_MAIN {
		PLAYER_NAME[MAX_PLAYER_NAME],
		PLAYER_IP[MAX_PLAYER_IP],
		PLAYER_LEVEL,
		PLAYER_TRUSTED,
		PLAYER_JOB,
		PLAYER_CASH,
		PLAYER_JAILED,
		PLAYER_COMMAND,
		PLAYER_COMMAND_AID_PLAYER[MAX_PLAYER_NAME],
		PLAYER_COMMAND_AIDA_PLAYER[MAX_PLAYER_NAME],
		PLAYER_COMMAND_SEX_PLAYER[MAX_PLAYER_NAME],
		PLAYER_COMMAND_SEX_PRICE,
		PLAYER_COMMAND_REPAIR_PLAYER[MAX_PLAYER_NAME],
		PLAYER_COMMAND_REPAIR_PRICE,
		PLAYER_COMMAND_COLOUR_PLAYER[MAX_PLAYER_NAME],
		PLAYER_COMMAND_COLOUR_PRICE,
		PLAYER_COMMAND_DRIVE_PLAYER[MAX_PLAYER_NAME],
		PLAYER_PRICE,
		PLAYER_TICKETCOP,
		PLAYER_TICKETPRICE,
		PLAYER_BOUNTY
		}

new gPlayerInfo[MAX_PLAYERS][PLAYER_MAIN];

public OnPlayerConnect(playerid)
{
    new string[48],PocketMoney[256]; GetPlayerName(playerid,pName,sizeof(pName)); GetPlayerIp(playerid,pIp,sizeof(pIp)); format(PlayerFile,sizeof(PlayerFile),"Paradise/Users/%s.ini",pName);
	if(!fexist(PlayerFile)){ dini_Create(PlayerFile); dini_Set(PlayerFile,"Name",pName);
							 dini_Set(PlayerFile,"Ip",pIp);
							 dini_Set(PlayerFile,"Level","0");
							 dini_Set(PlayerFile,"Trusted","0");
							 dini_Set(PlayerFile,"Job","0");
							 dini_Set(PlayerFile,"Cash","0");
							 dini_Set(PlayerFile,"Jailed","0");
						 	 dini_Set(PlayerFile,"Command","0");
						 	 dini_Set(PlayerFile,"AidPlayer","0");
						 	 dini_Set(PlayerFile,"AidaPlayer","0");
						 	 dini_Set(PlayerFile,"SexPlayer","0");
						 	 dini_Set(PlayerFile,"SexPrice","0");
						 	 dini_Set(PlayerFile,"RepairPlayer","0");
						 	 dini_Set(PlayerFile,"RepairPrice","0");
						 	 dini_Set(PlayerFile,"ColourPlayer","0");
						 	 dini_Set(PlayerFile,"ColourPrice","0");
						 	 dini_Set(PlayerFile,"DrivePlayer","0");
						 	 dini_Set(PlayerFile,"Price","0");
						 	 dini_Set(PlayerFile,"TicketCop","0");
						 	 dini_Set(PlayerFile,"TicketPrice","0");
						 	 dini_Set(PlayerFile,"Bounty","0");
						 	 }
    strcat(gPlayerInfo[playerid][PLAYER_NAME],					dini_Get(PlayerFile,"Name"));
 	strcat(gPlayerInfo[playerid][PLAYER_IP],					dini_Get(PlayerFile,"Ip"));
 	strcat(gPlayerInfo[playerid][PLAYER_LEVEL],					dini_Get(PlayerFile,"Level"));
 	strcat(gPlayerInfo[playerid][PLAYER_TRUSTED],				dini_Get(PlayerFile,"Trusted"));
 	strcat(gPlayerInfo[playerid][PLAYER_JOB],					dini_Get(PlayerFile,"Job"));
 	strcat(gPlayerInfo[playerid][PLAYER_CASH],					dini_Get(PlayerFile,"Cash"));
 	strcat(gPlayerInfo[playerid][PLAYER_JAILED],				dini_Get(PlayerFile,"Jailed"));
 	strcat(gPlayerInfo[playerid][PLAYER_COMMAND],				dini_Get(PlayerFile,"Command"));
 	strcat(gPlayerInfo[playerid][PLAYER_COMMAND_AID_PLAYER],	dini_Get(PlayerFile,"AidPlayer"));
 	strcat(gPlayerInfo[playerid][PLAYER_COMMAND_AIDA_PLAYER],	dini_Get(PlayerFile,"AidaPlayer"));
 	strcat(gPlayerInfo[playerid][PLAYER_COMMAND_SEX_PLAYER],    dini_Get(PlayerFile,"SexPlayer"));
 	strcat(gPlayerInfo[playerid][PLAYER_COMMAND_SEX_PRICE],		dini_Get(PlayerFile,"SexPrice"));
 	strcat(gPlayerInfo[playerid][PLAYER_COMMAND_REPAIR_PLAYER], dini_Get(PlayerFile,"RepairPlayer"));
 	strcat(gPlayerInfo[playerid][PLAYER_COMMAND_REPAIR_PRICE],	dini_Get(PlayerFile,"RepairPrice"));
 	strcat(gPlayerInfo[playerid][PLAYER_COMMAND_COLOUR_PLAYER], dini_Get(PlayerFile,"ColourPlayer"));
 	strcat(gPlayerInfo[playerid][PLAYER_COMMAND_COLOUR_PRICE],	dini_Get(PlayerFile,"ColourPrice"));
 	strcat(gPlayerInfo[playerid][PLAYER_COMMAND_DRIVE_PLAYER],	dini_Get(PlayerFile,"DrivePlayer"));
 	strcat(gPlayerInfo[playerid][PLAYER_PRICE],					dini_Get(PlayerFile,"Price"));
 	strcat(gPlayerInfo[playerid][PLAYER_TICKETCOP],				dini_Get(PlayerFile,"TicketCop"));
 	strcat(gPlayerInfo[playerid][PLAYER_TICKETPRICE],			dini_Get(PlayerFile,"TicketPrice"));
 	strcat(gPlayerInfo[playerid][PLAYER_BOUNTY],				dini_Get(PlayerFile,"Bounty"));
	GameTextForPlayer(playerid,"San Fierro: ~r~TDM",6000,5);
	GivePlayerMoney(playerid, strval(PocketMoney)); format(string, sizeof(string), "*** %s has joined the server.", pName); SendClientMessageToAll(COLOUR_GREY, string);
	printf("%s",gPlayerInfo[playerid][PLAYER_NAME]);
	printf("%d",gPlayerInfo[playerid][PLAYER_IP]);
	printf("%d",gPlayerInfo[playerid][PLAYER_PRICE]);
	return 1;
}


public OnPlayerDisconnect(playerid, reason)
{
    new string[56],playerName[MAX_PLAYER_NAME]; GetPlayerName(playerid,playerName,sizeof(playerName)); format(PlayerFile,sizeof(PlayerFile),"Paradise/Users/%s.ini",playerName);
    switch(reason) {
        case 0: format(string, sizeof(string), "*** %s has left the server. (Timeout)", playerName);
        case 1: format(string, sizeof(string), "*** %s has left the server. (Leaving)", playerName);
        case 2: format(string, sizeof(string), "*** %s has left the server. (Kicked)", playerName); }
    SendClientMessageToAll(COLOUR_GREY, string);
    dini_Set(PlayerFile,"Name",gPlayerInfo[playerid][PLAYER_NAME]);
	dini_Set(PlayerFile,"Ip",gPlayerInfo[playerid][PLAYER_IP]);
	dini_Set(PlayerFile,"Level",gPlayerInfo[playerid][PLAYER_LEVEL]);
	dini_Set(PlayerFile,"Trusted",gPlayerInfo[playerid][PLAYER_TRUSTED]);
	dini_Set(PlayerFile,"Job",gPlayerInfo[playerid][PLAYER_JOB]);
	dini_Set(PlayerFile,"Cash",gPlayerInfo[playerid][PLAYER_CASH]);
	dini_Set(PlayerFile,"Jailed",gPlayerInfo[playerid][PLAYER_JAILED]);
	dini_Set(PlayerFile,"Command",gPlayerInfo[playerid][PLAYER_COMMAND]);
	dini_Set(PlayerFile,"AidPlayer",gPlayerInfo[playerid][PLAYER_COMMAND_AID_PLAYER]);
	dini_Set(PlayerFile,"AidaPlayer",gPlayerInfo[playerid][PLAYER_COMMAND_AIDA_PLAYER]);
	dini_Set(PlayerFile,"SexPlayer",gPlayerInfo[playerid][PLAYER_COMMAND_SEX_PLAYER]);
	dini_Set(PlayerFile,"SexPrice",gPlayerInfo[playerid][PLAYER_COMMAND_SEX_PRICE]);
	dini_Set(PlayerFile,"RepairPlayer",gPlayerInfo[playerid][PLAYER_COMMAND_REPAIR_PLAYER]);
	dini_Set(PlayerFile,"RepairPrice",gPlayerInfo[playerid][PLAYER_COMMAND_REPAIR_PRICE]);
	dini_Set(PlayerFile,"ColourPlayer",gPlayerInfo[playerid][PLAYER_COMMAND_COLOUR_PLAYER]);
	dini_Set(PlayerFile,"ColourPrice",gPlayerInfo[playerid][PLAYER_COMMAND_COLOUR_PRICE]);
	dini_Set(PlayerFile,"DrivePlayer",gPlayerInfo[playerid][PLAYER_COMMAND_DRIVE_PLAYER]);
	dini_Set(PlayerFile,"Price",gPlayerInfo[playerid][PLAYER_PRICE]);
	dini_Set(PlayerFile,"TicketCop",gPlayerInfo[playerid][PLAYER_TICKETCOP]);
	dini_Set(PlayerFile,"TicketPrice",gPlayerInfo[playerid][PLAYER_TICKETPRICE]);
	dini_Set(PlayerFile,"Bounty",gPlayerInfo[playerid][PLAYER_BOUNTY]);
	gPlayerInfo[playerid][PLAYER_NAME] = 0;
	gPlayerInfo[playerid][PLAYER_IP] = 0;
	gPlayerInfo[playerid][PLAYER_LEVEL] = 0;
	gPlayerInfo[playerid][PLAYER_TRUSTED] = 0;
	gPlayerInfo[playerid][PLAYER_JOB] = 0;
	gPlayerInfo[playerid][PLAYER_CASH] = 0;
	gPlayerInfo[playerid][PLAYER_JAILED] = 0;
	gPlayerInfo[playerid][PLAYER_COMMAND] = 0;
	gPlayerInfo[playerid][PLAYER_COMMAND_AID_PLAYER] = 0;
	gPlayerInfo[playerid][PLAYER_COMMAND_AIDA_PLAYER] = 0;
	gPlayerInfo[playerid][PLAYER_COMMAND_SEX_PLAYER] = 0;
	gPlayerInfo[playerid][PLAYER_COMMAND_SEX_PRICE] = 0;
	gPlayerInfo[playerid][PLAYER_COMMAND_REPAIR_PLAYER] = 0;
	gPlayerInfo[playerid][PLAYER_COMMAND_REPAIR_PRICE] = 0;
	gPlayerInfo[playerid][PLAYER_COMMAND_COLOUR_PLAYER] = 0;
	gPlayerInfo[playerid][PLAYER_COMMAND_COLOUR_PRICE] = 0;
	gPlayerInfo[playerid][PLAYER_COMMAND_DRIVE_PLAYER] = 0;
	gPlayerInfo[playerid][PLAYER_PRICE] = 0;
	gPlayerInfo[playerid][PLAYER_TICKETCOP] = 0;
	gPlayerInfo[playerid][PLAYER_TICKETPRICE] = 0;
	gPlayerInfo[playerid][PLAYER_BOUNTY] = 0;
    return 1;
}