SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 01/11/2013, 02:26 PM   #1
Nadim
Little Clucker
 
Join Date: Oct 2013
Location: SA-MP
Posts: 37
Reputation: 0
Exclamation OPTIMIZE CODE!!!!!!!!

I need to optimize code (it strongly implies)[Нужна оптимизация кода]:
Code:
/*
SAMP Сервер Биг-Смоук (все права защищены!)
Копирование материала ЗАПРЕЩЕНО!!!
*/
public OnPlayerEnterCheckpoint(playerid)
{
	switch(avtobus1[playerid])
    {
        case 1:
		{
		    if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 437) return SendClientMessage(playerid,RED,"Возьми автобус для работы.");
			DisablePlayerRaceCheckpoint(playerid);
			avtobus1[playerid] = 2;
			SetPlayerRaceCheckpoint(playerid,0,1110.2404,-1743.8105,13.3984,1162.5702,-1743.5231,13.3984,5.0);
			return true;
		}
        
        case 2:
		{
        	if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 437) return SendClientMessage(playerid,RED,"Возьми автобус для работы.");
        	DisablePlayerRaceCheckpoint(playerid);
        	avtobus1[playerid] = 3;
        	SetPlayerRaceCheckpoint(playerid,0,1162.5702,-1743.5231,13.3984,1172.7688,-1751.2262,13.3984,5.0);
			return true;
		}
        
..............
        
        case 82:
		{
        	if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 437) return SendClientMessage(playerid,RED,"Возьми автобус для работы.");
        	DisablePlayerRaceCheckpoint(playerid);
        	avtobus1[playerid] = 83;
       		SetPlayerRaceCheckpoint(playerid,0,1109.9530,-1737.7393,13.5226,1109.9530,-1737.7393,100.0,5.0);
			return true;
		}
        
        case 83:
		{
			if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 437) return SendClientMessage(playerid,RED,"Возьми автобус для работы.");
        	DisablePlayerRaceCheckpoint(playerid);
        	SetPlayerSkin(playerid,avtobus3[playerid]);
        	SendClientMessage(playerid,0x006ED9AA,"Ты получил за свою работу: {CC3300}2000$");
        	GameTextForPlayer(playerid,"~G~+2000$",7500,5);
        	GivePlayerMoney(playerid,2000);
			new string[16],PlayerName[24];
			GetPlayerName(playerid,PlayerName,40);
			format(string,sizeof(string),"Accounts/%s.ini",PlayerName);
			new iniFile = ini_openFile(string);
			ini_getInteger(iniFile,"Avtobus",PIp[pAvtobus]);
			ini_setInteger(iniFile,"Avtobus",PIp[pAvtobus]+1);
			ini_closeFile(iniFile);
			return true;
		}
    }
	return true;
}
They're all the same (the difference in the coordinates) except 83 case!!!(758 size[Строк])
Nadim is offline   Reply With Quote
Old 01/11/2013, 03:04 PM   #2
iJumbo
High-roller
 
iJumbo's Avatar
 
Join Date: Sep 2009
Location: HEX 69 74 61 6C 79
Posts: 2,175
Reputation: 136
Default Re: OPTIMIZE CODE!!!!!!!!

You can create a stock !!!!!!!!!!!! Check this out !!!!!!! http://wiki.sa-mp.com/wiki/Stocks
__________________

Need a VPS? Get it here!
Website designer & developer php, html, css, html5, javascript
iJumbo is offline   Reply With Quote
Old 01/11/2013, 03:43 PM   #3
Nadim
Little Clucker
 
Join Date: Oct 2013
Location: SA-MP
Posts: 37
Reputation: 0
Exclamation Re: OPTIMIZE CODE!!!!!!!!

Quote:
Originally Posted by iJumbo View Post
You can create a stock !!!!!!!!!!!! Check this out !!!!!!! http://wiki.sa-mp.com/wiki/Stocks
Thank you!
Nadim is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Optimize this moneycheck? Face9000 Scripting Help 3 29/12/2011 10:29 PM
[HELP] Optimize files GPenner Help Archive 0 03/08/2011 04:02 PM
Optimize. Tomejus Help Archive 0 22/02/2011 02:12 PM
help me to optimize my code armyoftwo Help Archive 3 14/11/2010 10:19 AM


All times are GMT. The time now is 09:41 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.