08.08.2013, 20:00
IJumbo i know. But those topics did not help me further. And it mostly happens when a player connects. This is my OnPlayerConnect:
Also came to know when you are in a server and you put your PC into standy it just can freeze!
pawn Код:
public OnPlayerConnect(playerid)
{
KillTimer(APlayerData[playerid][VehicleTimer]);
ResetPlayerCash(playerid);
if (IsPlayerNPC(playerid))
return 1;
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
SetPlayerColor(playerid, 0xFFFFFF00);
PreloadAnimLib(playerid,"BOMBER");
PreloadAnimLib(playerid,"RAPPING");
PreloadAnimLib(playerid,"SHOP");
PreloadAnimLib(playerid,"BEACH");
PreloadAnimLib(playerid,"SMOKING");
PreloadAnimLib(playerid,"FOOD");
PreloadAnimLib(playerid,"ON_LOOKERS");
PreloadAnimLib(playerid,"DEALER");
PreloadAnimLib(playerid,"CRACK");
PreloadAnimLib(playerid,"CARRY");
PreloadAnimLib(playerid,"COP_AMBIENT");
PreloadAnimLib(playerid,"PARK");
PreloadAnimLib(playerid,"INT_HOUSE");
PreloadAnimLib(playerid,"FOOD");
PreloadAnimLib(playerid,"PED");
APlayerData[playerid][CurrentHouse] = -1;
//so the timer can be executed again
PlayerInfo[playerid][SpawnDance] = true;
APlayerData[playerid][LastPmID] = -1;
APlayerData[playerid][TruckerLicense] = 1;
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); //preventing a bug for the animation not being applied the first time OnPlayerRequestClass is called
OnPlayConnect(playerid);
GetPlayerName(playerid, APlayerData[playerid][Name], MAX_PLAYER_NAME); // Get the players name
CheckAccountExists(playerid); // Check if the account exists
APlayerData[playerid][EngineStarted] = 0; // Engine is not started
APlayerData[playerid][gEngine] = 0; // Second variable for engine bug
//Speedometer box
SpeedBox[playerid] = TextDrawCreate(500.0, 381, " ~n~~n~~n~~n~");
TextDrawUseBox(SpeedBox[playerid], 1);
TextDrawBoxColor(SpeedBox[playerid], 0x00000066); // Set the box color of the missiontext
TextDrawTextSize(SpeedBox[playerid], 620.0, 197.0);
//Model
Model[playerid] = TextDrawCreate(500.0, 381, " ");
TextDrawFont(Model[playerid], 2);
TextDrawColor(Model[playerid], 16777215);
TextDrawSetOutline(Model[playerid], 1);
TextDrawSetShadow(Model[playerid], 0);
TextDrawSetProportional(Model[playerid], true);
TextDrawLetterSize(Model[playerid],0.280000, 1.100000); // Set the lettersize
//speedometer
Speedometer[playerid] = TextDrawCreate(500.0,401.0 , " ");
TextDrawFont(Speedometer[playerid], 2);
TextDrawColor(Speedometer[playerid], 16777215);
TextDrawSetOutline(Speedometer[playerid], 1);
TextDrawSetShadow(Speedometer[playerid], 0);
TextDrawSetProportional(Speedometer[playerid], true);
TextDrawLetterSize(Speedometer[playerid],0.280000, 1.100000); // Set the lettersize
//Fuel
Fuel[playerid] = TextDrawCreate(500.0, 411.0, " ");
TextDrawFont(Fuel[playerid], 2);
TextDrawColor(Fuel[playerid], 16777215);
TextDrawSetOutline(Fuel[playerid], 1);
TextDrawSetShadow(Fuel[playerid], 0);
TextDrawSetProportional(Fuel[playerid], true);
TextDrawLetterSize(Fuel[playerid],0.280000, 1.100000); // Set the lettersize
//Status
Status[playerid] = TextDrawCreate(500.0, 391, " ");
TextDrawFont(Status[playerid], 2);
TextDrawColor(Status[playerid], 16777215);
TextDrawSetOutline(Status[playerid], 1);
TextDrawSetProportional(Status[playerid], true);
TextDrawSetShadow(Status[playerid], 0);
TextDrawLetterSize(Status[playerid],0.280000, 1.100000); // Set the lettersize
//Missiontext
Mission[playerid] = TextDrawCreate(320.0, 430.0, " "); // Setup the missiontext at the bottom of the screen
TextDrawAlignment(Mission[playerid], 2); // Align the missiontext to the center
TextDrawUseBox(Mission[playerid], 1); // Set the missiontext to display inside a box
TextDrawBoxColor(Mission[playerid], 0x00000066); // Set the box color of the missiontext
TextDrawFont(Mission[playerid], 2);
TextDrawBackgroundColor(Mission[playerid], 255);
TextDrawFont(Mission[playerid], 2);
TextDrawLetterSize(Mission[playerid], 0.260000, 1.300000);
TextDrawSetOutline(Mission[playerid], 0);
TextDrawSetProportional(Mission[playerid], 1);
TextDrawSetShadow(Mission[playerid], 1);
//Fineboard
Fineboard[playerid] = TextDrawCreate(499.0, 105.0, " ");
TextDrawUseBox(Fineboard[playerid], 1);
TextDrawBoxColor(Fineboard[playerid], 0x00000066);
TextDrawFont(Fineboard[playerid], 2);
TextDrawTextSize(Fineboard[playerid], 605.0, 197.0);
TextDrawLetterSize(Fineboard[playerid],0.280000, 1.100000); // Set the lettersize
//Location
APlayerData[playerid][Location] = TextDrawCreate(86.000000, 320.000000, " "); // Setup the area textdraw
TextDrawAlignment(APlayerData[playerid][Location], 2); // Align it to the left down corner
TextDrawBackgroundColor(APlayerData[playerid][Location], 255); // Set the background color
TextDrawFont(APlayerData[playerid][Location], 2); // Set the textdraws font
TextDrawLetterSize(APlayerData[playerid][Location],0.280000, 1.100000); // Set the lettersize
TextDrawColor(APlayerData[playerid][Location], -1); // Set the textdraw color
TextDrawSetOutline(APlayerData[playerid][Location], 1); // Set the outline
TextDrawSetProportional(APlayerData[playerid][Location], 1); //I dunno what this does
SetTimerEx("LocationText", 2500, true, "i", playerid);
//House car spawning
new string[128], rows, field, pname_[MAX_PLAYER_NAME];
cache_get_data(rows, field);
GetPlayerName(playerid, pname_, MAX_PLAYER_NAME);
mysql_real_escape_string(pname_, pname_);
format(string, sizeof(string), "SELECT `HouseID` FROM `Houses` WHERE `Houseowner`='%s'", pname_);
mysql_function_query( Handle, string, true, "OnPlayerHousesLoad", "d", playerid );
//Dealership mapicons
SetPlayerMapIcon(playerid, 8, 543.7410, -1292.0183, 17.2422, 55, 0, MAPICON_LOCAL);
SetPlayerMapIcon(playerid, 1, 2131.8037, -1150.6469, 24.1343, 55, 0, MAPICON_LOCAL);
SetPlayerMapIcon(playerid, 2, -1969.1692, 293.8963, 35.1719, 55, 0, MAPICON_LOCAL);
SetPlayerMapIcon(playerid, 3, -1656.6326, 1218.1990, 7.2500, 55, 0, MAPICON_LOCAL);
SetPlayerMapIcon(playerid, 4, 1671.5216, 1814.3015, 10.8203, 55, 0, MAPICON_LOCAL);
SetPlayerMapIcon(playerid, 5, 1948.6831, 2068.0332, 11.0610, 55, 0, MAPICON_LOCAL);
SetPlayerMapIcon(playerid, 6, 2200.9763, 1394.8071, 11.0625, 51, 0, MAPICON_LOCAL);
SetPlayerMapIcon(playerid, 7, -2186.9683, 2413.9592, 5.1563, 55, 0, MAPICON_LOCAL);
return 1;
}