06.10.2012, 15:50
(
Последний раз редактировалось Unfriendly; 06.10.2012 в 15:50.
Причина: Forgot to put a closing [/pawn] tag
)
Okay, so I wanted a moving camera on my "login" screen.
Note: Everything was working fine before I added the interpolating camera.
Anyway, now I click "Accept" or whatever to spawn, and it just reloads the login screen.
I have a command setup to teleport me to the starting location, which has nothing to do with spawning the player, it's just a separate command I added for debug purposes.
Here's the code. If I remove the interpolating camera, I can "spawn" again and everything works fine.
But I don't want to remove it.
Note: Everything was working fine before I added the interpolating camera.
Anyway, now I click "Accept" or whatever to spawn, and it just reloads the login screen.
I have a command setup to teleport me to the starting location, which has nothing to do with spawning the player, it's just a separate command I added for debug purposes.
Here's the code. If I remove the interpolating camera, I can "spawn" again and everything works fine.
But I don't want to remove it.
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
SpawnPlayer(playerid);
return 1;
}
////////////////////////////////
public OnPlayerConnect(playerid)
{
SetSpawnInfo(playerid, 0, 0, 2533.6003, -1699.4639, -500, 125.3129, 0, 0, 0, 0, 0, 0);
Textdraw0[playerid] = CreatePlayerTextDraw(playerid, 641.554, 1.500, "box");
PlayerTextDrawLetterSize(playerid, Textdraw0[playerid], 0.000, 11.961);
PlayerTextDrawTextSize(playerid, Textdraw0[playerid], -2.000, 0.000);
PlayerTextDrawAlignment(playerid, Textdraw0[playerid], 1);
PlayerTextDrawColor(playerid, Textdraw0[playerid], 0);
PlayerTextDrawUseBox(playerid, Textdraw0[playerid], 1);
PlayerTextDrawBoxColor(playerid, Textdraw0[playerid], 255);
PlayerTextDrawFont(playerid, Textdraw0[playerid], 0);
Textdraw1[playerid] = CreatePlayerTextDraw(playerid, 652.219, 340.980, "box");
PlayerTextDrawLetterSize(playerid, Textdraw1[playerid], 0.000, 18.451);
PlayerTextDrawTextSize(playerid, Textdraw1[playerid], -21.555, 0.000);
PlayerTextDrawAlignment(playerid, Textdraw1[playerid], 1);
PlayerTextDrawColor(playerid, Textdraw1[playerid], 0);
PlayerTextDrawUseBox(playerid, Textdraw1[playerid], 1);
PlayerTextDrawBoxColor(playerid, Textdraw1[playerid], 255);
PlayerTextDrawFont(playerid, Textdraw1[playerid], 0);
Textdraw2[playerid] = CreatePlayerTextDraw(playerid, 199.108, 81.634, "Chucky's Roleplay");
PlayerTextDrawLetterSize(playerid, Textdraw2[playerid], 0.777, 2.898);
PlayerTextDrawTextSize(playerid, Textdraw2[playerid], 448.444, 343.963);
PlayerTextDrawAlignment(playerid, Textdraw2[playerid], 1);
PlayerTextDrawColor(playerid, Textdraw2[playerid], -1);
PlayerTextDrawUseBox(playerid, Textdraw2[playerid], 1);
PlayerTextDrawBoxColor(playerid, Textdraw2[playerid], 0);
PlayerTextDrawSetOutline(playerid, Textdraw2[playerid], 1);
PlayerTextDrawFont(playerid, Textdraw2[playerid], 3);
PlayerTextDrawSetProportional(playerid, Textdraw2[playerid], 1);
Textdraw3[playerid] = CreatePlayerTextDraw(playerid, 276.444, 338.981, "Version 1.0");
PlayerTextDrawLetterSize(playerid, Textdraw3[playerid], 0.449, 1.600);
PlayerTextDrawTextSize(playerid, Textdraw3[playerid], 476.889, -7.466);
PlayerTextDrawAlignment(playerid, Textdraw3[playerid], 1);
PlayerTextDrawColor(playerid, Textdraw3[playerid], -1);
PlayerTextDrawUseBox(playerid, Textdraw3[playerid], 1);
PlayerTextDrawBoxColor(playerid, Textdraw3[playerid], 0);
PlayerTextDrawSetOutline(playerid, Textdraw3[playerid], 1);
PlayerTextDrawFont(playerid, Textdraw3[playerid], 1);
PlayerTextDrawSetProportional(playerid, Textdraw3[playerid], 1);
Textdraw4[playerid] = CreatePlayerTextDraw(playerid, 267.998, 3.982, "Welcome");
PlayerTextDrawLetterSize(playerid, Textdraw4[playerid], 0.661, 4.168);
PlayerTextDrawTextSize(playerid, Textdraw4[playerid], 356.000, 27.875);
PlayerTextDrawAlignment(playerid, Textdraw4[playerid], 1);
PlayerTextDrawColor(playerid, Textdraw4[playerid], -1);
PlayerTextDrawUseBox(playerid, Textdraw4[playerid], 1);
PlayerTextDrawBoxColor(playerid, Textdraw4[playerid], 0);
PlayerTextDrawSetOutline(playerid, Textdraw4[playerid], 1);
PlayerTextDrawBackgroundColor(playerid, Textdraw4[playerid], 51);
PlayerTextDrawFont(playerid, Textdraw4[playerid], 3);
PlayerTextDrawSetProportional(playerid, Textdraw4[playerid], 1);
Textdraw5[playerid] = CreatePlayerTextDraw(playerid, 306.665, 52.265, "To");
PlayerTextDrawLetterSize(playerid, Textdraw5[playerid], 0.449, 1.600);
PlayerTextDrawAlignment(playerid, Textdraw5[playerid], 1);
PlayerTextDrawColor(playerid, Textdraw5[playerid], -1);
PlayerTextDrawUseBox(playerid, Textdraw5[playerid], 1);
PlayerTextDrawBoxColor(playerid, Textdraw5[playerid], 0);
PlayerTextDrawSetOutline(playerid, Textdraw5[playerid], 1);
PlayerTextDrawBackgroundColor(playerid, Textdraw5[playerid], 51);
PlayerTextDrawFont(playerid, Textdraw5[playerid], 1);
PlayerTextDrawSetProportional(playerid, Textdraw5[playerid], 1);
return 1;
}
///////////////////////////////////////
public OnPlayerSpawn(playerid)
{
PlayerTextDrawShow(playerid, Textdraw0[playerid]);
PlayerTextDrawShow(playerid, Textdraw1[playerid]);
PlayerTextDrawShow(playerid, Textdraw2[playerid]);
PlayerTextDrawShow(playerid, Textdraw3[playerid]);
PlayerTextDrawShow(playerid, Textdraw4[playerid]);
PlayerTextDrawShow(playerid, Textdraw5[playerid]);
TogglePlayerSpectating(playerid, 1);
InterpolateCameraPos(playerid, 1418.749877, -1654.822631, 44.366916, 2187.340576, -1105.461791, 41.650379, 120000);
InterpolateCameraLookAt(playerid, 1420.227050, -1659.541870, 43.627452, 2189.703857, -1109.785766, 40.802928, 120000);
new string[256];
new name[24];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "SELECT `username` FROM `players` WHERE `username` = '%s'", name);
mysql_query(string);
mysql_store_result();
if(mysql_num_rows() == 0)
{
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_PASSWORD, "Register", "Hello. Please enter your password for register:", "Accept", "Cancel");
}
else
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Login", "Hello. Please, enter your password for authorization", "Accept", "Cancel");
}
return 1;
}
/////////////////////////////////////////////////////
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
///////This part is for an admin tools command
if(dialogid == 2)
{
if(response)
{
if(listitem == 0)
{
GivePlayerMoney(playerid, 999999999);
}
if(listitem == 1)
{
GivePlayerWeapon(playerid, 31, 5000);
SetPlayerHealth(playerid, 999999999);
}
if(listitem == 2)
{
SendClientMessage(playerid, 1, "Coming Soon.");
}
}
}
///////here's where the trouble is.
new string[512];
new name[24];
new password[16];
if(dialogid == 0)
{
if(response)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_PASSWORD, "Register", "Hello. Please choose a password:", "Accept", "Cancel");
return 1;
}
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "SELECT * FROM `players` WHERE `username` = '%s'", inputtext);
mysql_query(string);
mysql_store_result();
if(mysql_num_rows() == 1)
{
SendClientMessage(playerid, 0xFFFFFFFF, "This name is in use. Please try again.");
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_PASSWORD, "Register", "Hello. Please choose a password:", "Accept", "Cancel");
}
else
{
strmid(password, inputtext, 0, strlen(inputtext), 255);
format(string, sizeof(string), "INSERT INTO `players` (`username`, `password`, `money`) VALUES ('%s', '%s', '%d')", name, inputtext, 200);
mysql_query(string);
mysql_free_result();
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Login", "Hello. Please, enter your password for authorization:", "Accept", "Cancel");
}
}
}
if(dialogid == 1)
{
if(response)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Login", "Hello. Please, enter your password for authorization:", "Accept", "Cancel");
return 1;
}
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "SELECT * FROM `players` WHERE `username` = '%s' AND `password` = '%s'", name, inputtext);
mysql_query(string);
mysql_store_result();
if(mysql_num_rows() == 0)
{
SendClientMessage(playerid, 0xFFFFFFFF, "Password incorrect! Please try again.");
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Login", "Hello. Please, enter your password for authorization:", "Accept", "Cancel");
}
else
{
format(string, sizeof(string), "SELECT * FROM `players` WHERE `username` = '%s'", name);
if(mysql_retrieve_row())
{
new result[32];
mysql_get_field("money", result);
plInfo[playerid][pMoney] = strval(result);
GivePlayerMoney(playerid, plInfo[playerid][pMoney]);
SendClientMessage(playerid, 0xFFFFFFFF, "Thanks!");
TogglePlayerSpectating(playerid, 0);
SetCameraBehindPlayer(playerid);
SetPlayerPos(playerid, 2533.6003,-1699.4639,13.3828);
SetPlayerFacingAngle(playerid, 125.3129);
PlayerTextDrawHide(playerid, Textdraw0[playerid]);
PlayerTextDrawHide(playerid, Textdraw1[playerid]);
PlayerTextDrawHide(playerid, Textdraw2[playerid]);
PlayerTextDrawHide(playerid, Textdraw3[playerid]);
PlayerTextDrawHide(playerid, Textdraw4[playerid]);
PlayerTextDrawHide(playerid, Textdraw5[playerid]);
}
}
}
}
return 1;
}