SA-MP Forums Archive
CMD:Engine crashes the server - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: CMD:Engine crashes the server (/showthread.php?tid=445647)



CMD:Engine crashes the server - Slaykler - 22.06.2013

Код:
CMD:engine(playerid, params[])
{
	new mainstring[256];
	#pragma unused params
	if(IsPlayerConnected(playerid) && PlayerInfo[playerid][pLogged] == 1)
	{
	    new vehicleid = GetPlayerVehicleID(playerid);
		if(IsPlayerInAnyVehicle(playerid) && !IsModelABycicle(vehicleid))
	    {
	        if(VehicleInfo[vehicleid][cFuel] == 0)
	        {
	            return GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~No fuel in Vehicle",1500,3);
			}
	    	if(VehicleInfo[vehicleid][cEngine] == 0)
		    {
			   	VehicleInfo[vehicleid][cEngine] = 2;
			   	SetTimerEx("StartEngine", 5000, 0, "i", playerid);
			   	//SendClientMessage(playerid, COLOR_WHITE, "{FFCC66}[Server]: {FFFFFF}Vehicle engine starting.");
			   	format(mainstring, sizeof(mainstring), "* %s is starting the engine of the %s", GPN(playerid), aVehicleNames[GetVehicleModel(vehicleid)-400]);
				ProxDetector(30.0, playerid, mainstring, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			}
			else if(VehicleInfo[vehicleid][cEngine] == 1)
		    {
			   	VehicleInfo[vehicleid][cEngine] = 0;
			   	ToggleEngine(vehicleid, VEHICLE_PARAMS_OFF);
			   	//SendClientMessage(playerid, COLOR_WHITE, "{FFCC66}[Server]: {FFFFFF}Vehicle engine stopped.");
			   	format(mainstring, sizeof(mainstring), "* %s has stopped the engine of %s.", GPN(playerid), aVehicleNames[GetVehicleModel(vehicleid)-400]);
				ProxDetector(30.0, playerid, mainstring, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			}
		}
	}
	else
	{
	    return SendClientMessage(playerid,COLOR_WHITE,NOTLOGGED);
	}
	return 1;
}