⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 taxifr.pwn

📁 著名网络游戏
💻 PWN
📖 第 1 页 / 共 5 页
字号:
	if(Filling[i] == 1)
	  {
        VehicleInfo[GetPlayerVehicleID(i)][gas]++;
        GivePlayerMoney(i,-2);
      }
   }
  return 1;
 }

stock LoadVehicles()
{
	if(fexist(V_FILE_SAVE)) {
        new SplitDiv[99][V_LIMIT];
		new filestring[256];
		new File: file = fopen(V_FILE_SAVE, io_read);
		if (file) {
	    	for(new vehicleid = 1;vehicleid<=vehcount;vehicleid++)
			{
		    	fread(file, filestring);
				split(filestring, SplitDiv, ',');
				VehicleInfo[vehicleid][model] = strval(SplitDiv[0]);
				VehicleInfo[vehicleid][x_spawn] = floatstr(SplitDiv[1]);
				VehicleInfo[vehicleid][y_spawn] = floatstr(SplitDiv[2]);
				VehicleInfo[vehicleid][z_spawn] = floatstr(SplitDiv[3]);
				VehicleInfo[vehicleid][za_spawn] = floatstr(SplitDiv[4]);
				VehicleInfo[vehicleid][color_1] = strval(SplitDiv[5]);
				VehicleInfo[vehicleid][color_2] = strval(SplitDiv[6]);
				VehicleInfo[vehicleid][vehiclecost] = strval(SplitDiv[7]);
				VehicleInfo[vehicleid][bought] = strval(SplitDiv[8]);
				VehicleInfo[vehicleid][secure] = strval(SplitDiv[9]);
				VehicleInfo[vehicleid][asecure] = strval(SplitDiv[10]);
				VehicleInfo[vehicleid][vused] = 0;
				VehicleInfo[vehicleid][buybar] = strval(SplitDiv[12]);
				VehicleInfo[vehicleid][mod1] = strval(SplitDiv[13]);
				VehicleInfo[vehicleid][mod2] = strval(SplitDiv[14]);
				VehicleInfo[vehicleid][mod3] = strval(SplitDiv[15]);
				VehicleInfo[vehicleid][mod4] = strval(SplitDiv[16]);
				VehicleInfo[vehicleid][mod5] = strval(SplitDiv[17]);
				VehicleInfo[vehicleid][mod6] = strval(SplitDiv[18]);
				VehicleInfo[vehicleid][mod7] = strval(SplitDiv[19]);
				VehicleInfo[vehicleid][mod8] = strval(SplitDiv[20]);
				VehicleInfo[vehicleid][mod9] = strval(SplitDiv[21]);
				VehicleInfo[vehicleid][mod10] = strval(SplitDiv[22]);
				VehicleInfo[vehicleid][mod11] = strval(SplitDiv[23]);
				VehicleInfo[vehicleid][mod12] = strval(SplitDiv[24]);
				VehicleInfo[vehicleid][mod13] = strval(SplitDiv[25]);
				VehicleInfo[vehicleid][mod14] = strval(SplitDiv[26]);
				VehicleInfo[vehicleid][mod15] = strval(SplitDiv[27]);
				VehicleInfo[vehicleid][mod16] = strval(SplitDiv[28]);
				VehicleInfo[vehicleid][mod17] = strval(SplitDiv[29]);
				VehicleInfo[vehicleid][paintjob] = strval(SplitDiv[32]);
				strmid(VehicleInfo[vehicleid][owner], SplitDiv[30], 0, strlen(SplitDiv[30]), 255);
				strmid(VehicleInfo[vehicleid][name], SplitDiv[31], 0, strlen(SplitDiv[31]), 255);
			 	CreateVehicle(VehicleInfo[vehicleid][model], VehicleInfo[vehicleid][x_spawn], VehicleInfo[vehicleid][y_spawn], VehicleInfo[vehicleid][z_spawn], VehicleInfo[vehicleid][za_spawn], VehicleInfo[vehicleid][color_1], VehicleInfo[vehicleid][color_2],20000);
				new addmess[256];
				format(addmess,sizeof(addmess),"--:: Vehicle %d (%s) successfully spawned - owner: %s ::--",vehicleid,VehicleInfo[vehicleid][name],VehicleInfo[vehicleid][owner]);
				print(addmess);
			}
		}
		fclose(file);
	}
	else {
		SetupVehiclesFile();
	}
}

stock LoadBusinesses()
{
	if(fexist(B_FILE_SAVE)) {
        new SplitDiv[99][B_LIMIT];
		new filestring[256];
		new File: file = fopen(B_FILE_SAVE, io_read);
		if (file) {
	    	for(new bizid = 0;bizid<bizcount;bizid++)
			{
		    	fread(file, filestring);
				split(filestring, SplitDiv, ',');
				BizInfo[bizid][xpos] = floatstr(SplitDiv[0]);
				BizInfo[bizid][ypos] = floatstr(SplitDiv[1]);
				BizInfo[bizid][zpos] = floatstr(SplitDiv[2]);
				strmid(BizInfo[bizid][owner], SplitDiv[3], 0, strlen(SplitDiv[3]), 255);
				strmid(BizInfo[bizid][name], SplitDiv[4], 0, strlen(SplitDiv[4]), 255);
				BizInfo[bizid][bought] = strval(SplitDiv[5]);
				BizInfo[bizid][cost] = strval(SplitDiv[6]);
				BizInfo[bizid][profit] = strval(SplitDiv[7]);
				BizInfo[bizid][cashbox] = strval(SplitDiv[8]);
			 	AddStaticPickup(B_ICON,B_ICON_TYPE, BizInfo[bizid][xpos], BizInfo[bizid][ypos], BizInfo[bizid][zpos]);
				new addmess[256];
				format(addmess,sizeof(addmess),"--:: Business %d (%s) successfully spawned - owner: %s ::--",bizid,BizInfo[bizid][name],BizInfo[bizid][owner]);
				print(addmess);
			}
		}
		fclose(file);
	}
	else {
		SetupBizFile();
	}
}

stock SaveBusinesses()
{
	new filestring[256];
	new File: bfile = fopen(B_FILE_SAVE, io_write);
	    for(new bizid = 0;bizid<bizcount;bizid++)
     	{
			format(filestring, sizeof(filestring), "%f,%f,%f,%s,%s,%d,%d,%d,%d\n",
			BizInfo[bizid][xpos],
			BizInfo[bizid][ypos],
			BizInfo[bizid][zpos],
			BizInfo[bizid][owner],
			BizInfo[bizid][name],
			BizInfo[bizid][bought],
			BizInfo[bizid][cost],
			BizInfo[bizid][profit],
			BizInfo[bizid][cashbox]
			);
			fwrite(bfile, filestring);
		}
		fclose(bfile);
}

stock SetupBizFile()
{
    new File: file;
    new SplitDiv[99][B_LIMIT];
	new filestring[256];
	file = fopen(B_FILE_LOAD, io_read);
	for(new bizid=0;bizid<bizcount;bizid++)
	{
		if (file)
		{
			fread(file, filestring);
		 	split(filestring, SplitDiv, ',');
			BizInfo[bizid][xpos] = floatstr(SplitDiv[0]);
			BizInfo[bizid][ypos] = floatstr(SplitDiv[1]);
			BizInfo[bizid][zpos] = floatstr(SplitDiv[2]);
			strmid(BizInfo[bizid][owner], DEFAULT_OWNER, 0, strlen(DEFAULT_OWNER), 255);
			strmid(BizInfo[bizid][name], SplitDiv[3], 0, strlen(SplitDiv[3]), 255);
			BizInfo[bizid][bought] = 0;
			BizInfo[bizid][cost] = strval(SplitDiv[4]);
			BizInfo[bizid][profit] = strval(SplitDiv[5]);
			BizInfo[bizid][cashbox] = 0;
            AddStaticPickup(B_ICON,B_ICON_TYPE, BizInfo[bizid][xpos], BizInfo[bizid][ypos], BizInfo[bizid][zpos]);
			new addmess[256];
			format(addmess,sizeof(addmess),"--:: Business %d (%s) successfully spawned ::--",bizid,BizInfo[bizid][name]);
			print(addmess);
		}
	}
	fclose(file);
	print(">------------------------------------------------");
	print(" ");
	print(">------------------------------------------------");
	print("Initialising Business File System - Please Wait For Confirmation...");
	print(" ");
	SaveBusinesses();
	print(" ");
	print("Business File System 100% Initialised...");
	print(">------------------------------------------------");
	printf(" ");
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
 if(pickupid < bizcount) {
		new bizowner[25];
		format(bizowner,256,"%s",BizInfo[pickupid][owner]);
		if(strcmp(BizInfo[pickupid][owner],DEFAULT_OWNER,false) == 0) {
	    	format(bizowner,256,"Not Owned");
		}
		new bizmes[256];
		format(bizmes,256,"~n~~n~~r~Business: ~g~%s~n~~r~Price: ~g~$%d ~r~~n~~r~Profit: ~g~$%d/hr ~n~~r~Owner: ~g~%s",BizInfo[pickupid][name],BizInfo[pickupid][cost],BizInfo[pickupid][profit]*2,bizowner);
    	GameTextForPlayer(playerid,bizmes,5000,3);
		bizmsg[playerid] = 1;
		SetTimerEx("ResetText",5000,0,"i",playerid);
		return 1;
	}
	new upto = bizcount+20;
 	if(pickupid < upto) {
    	GameTextForPlayer(playerid,"~g~Type ~r~/fuelhelp ~g~to see how to refill.",5000,3);
		bizmsg[playerid] = 1;
		SetTimerEx("ResetText",5000,0,"i",playerid);
		return 1;
	}
 	upto = bizcount+23;
 	if(pickupid < upto) {
    	GameTextForPlayer(playerid,"~b~Type ~y~/bankhelp ~b~to see how to use the bank.",5000,3);
		bizmsg[playerid] = 1;
		SetTimerEx("ResetText",5000,0,"i",playerid);
		return 1;
	}
	return 1;
}

public ResetText(playerid)
{
	bizmsg[playerid] = 0;
}

stock CloseToGas(playerid)
{
    new Float:maxdis = 15.0;
	new Float:ppos[3];
    GetPlayerPos(playerid, ppos[0], ppos[1], ppos[2]);
    for(new i = 0;i<16;i++) {
    	if (ppos[0] >= floatsub(Pickup[i][0], maxdis) && ppos[0] <= floatadd(Pickup[i][0], maxdis)
    	&& ppos[1] >= floatsub(Pickup[i][1], maxdis) && ppos[1] <= floatadd(Pickup[i][1], maxdis)
    	&& ppos[2] >= floatsub(Pickup[i][2], maxdis) && ppos[2] <= floatadd(Pickup[i][2], maxdis))
    	{
        	return i;
    	}
	}
	maxdis = 20.0;
	for(new i = 16;i<20;i++) {
    	if (ppos[0] >= floatsub(Pickup[i][0], maxdis) && ppos[0] <= floatadd(Pickup[i][0], maxdis)
    	&& ppos[1] >= floatsub(Pickup[i][1], maxdis) && ppos[1] <= floatadd(Pickup[i][1], maxdis)
    	&& ppos[2] >= floatsub(Pickup[i][2], maxdis) && ppos[2] <= floatadd(Pickup[i][2], maxdis))
    	{
        	return i;
    	}
	}
	return 999;
}

stock CloseToBank(playerid)
{
    new Float:maxdis = 20.0;
	new Float:ppos[3];
    GetPlayerPos(playerid, ppos[0], ppos[1], ppos[2]);
	for(new i = 20;i<23;i++) {
    	if (ppos[0] >= floatsub(Pickup[i][0], maxdis) && ppos[0] <= floatadd(Pickup[i][0], maxdis)
    	&& ppos[1] >= floatsub(Pickup[i][1], maxdis) && ppos[1] <= floatadd(Pickup[i][1], maxdis)
    	&& ppos[2] >= floatsub(Pickup[i][2], maxdis) && ppos[2] <= floatadd(Pickup[i][2], maxdis))
    	{
        	return i;
    	}
	}
	return 999;
}

stock ClosestBiz(playerid)
{
    new Float:ppos[3];
    new Float:maxdis = 7.0;
    GetPlayerPos(playerid, ppos[0], ppos[1], ppos[2]);
    for(new i = 0;i<bizcount;i++) {
    	if (ppos[0] >= floatsub(BizInfo[i][xpos], maxdis) && ppos[0] <= floatadd(BizInfo[i][xpos], maxdis)
    	&& ppos[1] >= floatsub(BizInfo[i][ypos], maxdis) && ppos[1] <= floatadd(BizInfo[i][ypos], maxdis)
    	&& ppos[2] >= floatsub(BizInfo[i][zpos], maxdis) && ppos[2] <= floatadd(BizInfo[i][zpos], maxdis))
    	{
        	return i;
    	}
	}
	return 999;
}


stock SaveVehicles()
{
	new filestring[256];
	new File: vfile = fopen(V_FILE_SAVE, io_write);
	    for(new vehicleid = 1;vehicleid<=vehcount;vehicleid++)
     	{
			format(filestring, sizeof(filestring), "%d,%f,%f,%f,%f,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%s,%s,%d\n",
			VehicleInfo[vehicleid][model],
			VehicleInfo[vehicleid][x_spawn],
			VehicleInfo[vehicleid][y_spawn],
			VehicleInfo[vehicleid][z_spawn],
			VehicleInfo[vehicleid][za_spawn],
			VehicleInfo[vehicleid][color_1],
			VehicleInfo[vehicleid][color_2],
			VehicleInfo[vehicleid][vehiclecost],
			VehicleInfo[vehicleid][bought],
			VehicleInfo[vehicleid][secure],
			VehicleInfo[vehicleid][asecure],
			VehicleInfo[vehicleid][vused],
			VehicleInfo[vehicleid][buybar],
			VehicleInfo[vehicleid][mod1],
			VehicleInfo[vehicleid][mod2],
			VehicleInfo[vehicleid][mod3],
			VehicleInfo[vehicleid][mod4],
			VehicleInfo[vehicleid][mod5],
			VehicleInfo[vehicleid][mod6],
			VehicleInfo[vehicleid][mod7],
			VehicleInfo[vehicleid][mod8],
			VehicleInfo[vehicleid][mod9],
			VehicleInfo[vehicleid][mod10],
			VehicleInfo[vehicleid][mod11],
			VehicleInfo[vehicleid][mod12],
			VehicleInfo[vehicleid][mod13],
			VehicleInfo[vehicleid][mod14],
			VehicleInfo[vehicleid][mod15],
			VehicleInfo[vehicleid][mod16],
			VehicleInfo[vehicleid][mod17],
			VehicleInfo[vehicleid][owner],
			VehicleInfo[vehicleid][name],
			VehicleInfo[vehicleid][paintjob]
			);
			fwrite(vfile, filestring);
		}
		fclose(vfile);
}

stock ModVehicle(vehicleid)
{
    new tuned2 = 0;
	if(VehicleInfo[vehicleid][mod1] != 0) {
		AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod1]);
		tuned2 = 1;
	}
	if(VehicleInfo[vehicleid][mod2] != 0) {
		AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod2]);
		tuned2 = 1;
	}
	if(VehicleInfo[vehicleid][mod3] != 0) {
		AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod3]);
		tuned2 = 1;
	}
	if(VehicleInfo[vehicleid][mod4] != 0) {
		AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod4]);
		tuned2 = 1;
	}
	if(VehicleInfo[vehicleid][mod5] != 0) {
		AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod5]);
		tuned2 = 1;
	}
	if(VehicleInfo[vehicleid][mod6] != 0) {
		AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod6]);
		tuned2 = 1;
	}
	if(VehicleInfo[vehicleid][mod7] != 0) {
		AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod7]);
		tuned2 = 1;
	}
	if(VehicleInfo[vehicleid][mod8] != 0) {
		AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod8]);
		tuned2 = 1;
 	}
	if(VehicleInfo[vehicleid][mod9] != 0) {
		AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod9]);
		tuned2 = 1;
	}
	if(VehicleInfo[vehicleid][mod10] != 0) {
		AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod10]);
		tuned2 = 1;
	}
	if(VehicleInfo[vehicleid][mod11] != 0) {
		AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod11]);
		tuned2 = 1;
	}
	if(VehicleInfo[vehicleid][mod12] != 0) {
		AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod12]);
		tuned2 = 1;
	}
	if(VehicleInfo[vehicleid][mod13] != 0) {
		AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod13]);
		tuned2 = 1;
	}
	if(VehicleInfo[vehicleid][mod14] != 0) {
		AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod14]);
		tuned2 = 1;
	}
	if(VehicleInfo[vehicleid][mod15] != 0) {
		AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod15]);
		tuned2 = 1;
	}
	if(VehicleInfo[vehicleid][mod16] != 0) {
		AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod16]);
		tuned2 = 1;
	}
	if(VehicleInfo[vehicleid][mod17] != 0) {
		AddVehicleComponent(vehicleid,VehicleInfo[vehicleid][mod17]);
		tuned2 = 1;
	}
	if(VehicleInfo[vehicleid][color_1] > -1 || VehicleInfo[vehicleid][color_2] > -1) {
		ChangeVehicleColor(vehicleid,VehicleInfo[vehicleid][color_1],VehicleInfo[vehicleid][color_2]);
		tuned2 = 1;
 	}
	if(VehicleInfo[vehicleid][paintjob] > -1) {
		ChangeVehiclePaintjob(vehicleid,VehicleInfo[vehicleid][paintjob]);
		tuned2 = 1;
 	}
	if(tuned2 == 1) {
	    tuned++;
	}
}

stock IsPlayerNameOnline(compname[])
{
	new playername[MAX_PLAYER_NAME];
    for(new i=0;i<=MAX_PLAYERS;i++) {
        if(IsPlayerConnected(i)) {
            GetPlayerName(i, playername, sizeof(playername));
            if(strcmp(playername,compname,false) == 0) {
                return i;
			}
		}
	}
	return 1000;
}

public OnPlayerConnect(playerid)
{
	new fname[256],playername[256],string[256];
	GetPlayerName(playerid, playername, sizeof(playername));
	format(string, sizeof(string), "^^^ %s has joined the server.(Connect) ^^^", playername);
	SendClientMessageToAll(COLOR_GREY, string);
 	format(fname,sizeof(fname),P_FILE,udb_encode(playername));
		if(!fexist(fname)) {
	    	SendClientMessage(playerid, COLOR_BRIGHTRED, "-----------------------------------------------------------------------------------------------------------------------");
			format(string, sizeof(string), "Welcome %s, to the new tAxi's RPG/Freeroam World!", playername);
			SendClientMessage(playerid, COLOR_ORANGE, string);
			SendClientMessage(playerid, COLOR_BRIGHTRED, "-----------------------------------------------------------------------------------------------------------------------");
			SendClientMessage(playerid,COLOR_YELLOW, "You have been given $25000 starting money since you have no saved money as of yet!");
        	SendClientMessage(playerid,COLOR_YELLOW, "You can register your current player name with '/register [password]'");
        	SendClientMessage(playerid,COLOR_ORANGE, "You must register and login to gain access to money, bank and vehicle saving options!");
        	SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /help to get started and type /credits for a list of ppl who contributed.");
        	SendClientMessage(playerid, COLOR_BRIGHTRED, "-----------------------------------------------------------------------------------------------------------------------");
			GivePlayerMoney(playerid,25000);
	}
    if(fexist(fname)) {
			SendClientMessage(playerid, COLOR_BRIGHTRED, "-----------------------------------------------------------------------------------------------------------------------");
			format(string, sizeof(string), "Welcome %s, to the new tAxi's RPG/Freeroam World!", playername);
			SendClientMessage(playerid, COLOR_ORANGE, string);
			SendClientMessage(playerid, COLOR_BRIGHTRED, "-----------------------------------------------------------------------------------------------------------------------");
			format(string,sizeof(string),"The name %s, is already registered on this server. Please login or you will be disconnected in 30 seconds!",playername);
        	SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        	SendClientMessage(playerid, COLOR_BRIGHTRED, "-----------------------------------------------------------------------------------------------------------------------");
			SetTimerEx("KickTimer",30000,0,"i",playerid);
		}
    for(new i=0;i<bizcount;i++) {
        if(BizInfo[i][bought] == 0) {
			SetPlayerMapIcon(playerid,i,BizInfo[i][xpos],BizInfo[i][ypos],BizInfo[i][zpos],31,1);
		}
		else {
		    SetPlayerMapIcon(playerid,i,BizInfo[i][xpos],BizInfo[i][ypos],BizInfo[i][zpos],32,1);
		}
	}
	for(new i=0;i<20;i++) {
		SetPlayerMapIcon(playerid,i+bizcount,Pickup[i][0],Pickup[i][1],Pickup[i][2],55,1);
	}
    speedo[playerid] = 1;
	Filling[playerid] = 0;
	PlayerInfo[playerid][logged] = 0;
	PlayerInfo[playerid][vhpb] = 1;
	Calling[playerid] = -1;
	Answered[playerid] = 0;
	Callerid[playerid] = 0;
}
stock ReplaceMapIcon(playerid,iconid)
{
	RemovePlayerMapIcon(playerid,iconid);
	if(BizInfo[iconid][bought] == 0) {
		SetPlayerMapIcon(playerid,iconid,BizInfo[iconid][xpos],BizInfo[iconid][ypos],BizInfo[iconid][zpos],31,1)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -