19.03.2013, 14:12
Help me please
OnDialog to big dialog I will not show all dialogs but there is a bit:
OnPlayerRegister
Ohh and Player cant spawn.. I don't know why!
pawn Код:
public OnPlayerRegister(playerid, password[])
{
if(IsPlayerConnected(playerid))
{
new string3[32];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(string3, sizeof(string3), "users/%s.ini", playername3);
new File: hFile = fopen(string3, io_write);
if (hFile)
{
savingdatahere
}
Writeends here
OnPlayerLogin(playerid, password);
SendClientMessageEx(playerid, COLOR_YELLOW, "Account registered, you have been logged in automatically.");
TotalRegister++;
}
}
return 1;
}
pawn Код:
SetPlayerSpawn(playerid)
{
if(PlayerInfo[playerid][pTut] == 0)
{
gOoc[playerid] = 1; gNews[playerid] = 1; gFam[playerid] = 1;
TogglePlayerControllable(playerid,1);
SetPlayerColor(playerid,TEAM_HIT_COLOR);
SetPlayerPos(playerid, 766.50, -1684.32, -6.86);
SetPlayerCameraPos(playerid, 751.93, -1673.95, 16.01);
SetPlayerCameraLookAt(playerid, 699.55, -1628.93, 5.88);
RegistrationStep[playerid] = 1;
print("Reached point 3");
ShowPlayerDialog(playerid,dregister1,DIALOG_STYLE_INPUT,"Error","When is your Birthday? ( DD/MM/YYYY )","Enter","Cancel");
SetPlayerVirtualWorld(playerid, 1984);
return 1;
}
}
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new sendername[MAX_PLAYER_NAME];
new string[128];
// Crash Bug Fix
if(!IsNull(inputtext))
{
if(strfind(inputtext, "%s", true) != -1)
{
format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) is possibly dialog-exploiting by attempting to send a null string.", GetPlayerNameEx(playerid), playerid);
ABroadCast(COLOR_YELLOW, string, 2);
format(string, sizeof(string), "%s has attempted to insert a false string placeholder into a dialog.", GetPlayerNameEx(playerid));
Log("logs/crash.log", string);
Kick(playerid);
return 1;
}
}
if(dialogid == register)
{
if(RegistrationStep[playerid] == 1)
{
print("Reached point 1");
if(response && strlen(inputtext))
{
print("Reached point 2");
new year, month, day;
getdate(year, month, day);
new DateInfo[3];
sscanf(inputtext, "p</>ddd", DateInfo[0], DateInfo[1], DateInfo[2]);
printf("Data: %d/%02d/%02d, from input %d/%02d/%02d", year, month, day, DateInfo[0], DateInfo[1], DateInfo[2]);
new age = year - DateInfo[2];
printf("Age is %d", age);
if(1 > age > 100)
{
return ShowPlayerDialog(playerid,dregister1,DIALOG_STYLE_INPUT,"Error","When is your Birthday? ( DD/MM/YYYY )","Enter","Cancel");
}
if(DateInfo[1] > month || (DateInfo[1] == month && DateInfo[0] > day)) age -= 1;
printf("Age is now %d", age);
PlayerInfo[playerid][pAge] = age;
ShowPlayerDialog(playerid, dregister2, DIALOG_STYLE_LIST, "Okay. Where are you from?","Los Santos\nSan Fierro\nLos Venturas\nLiberty City\n", "Select", "Cancel");
print("Done");
RegistrationStep[playerid] = 2;
}
}
}
if (dialogid == register1)
{
if(RegistrationStep[playerid] == 2)
{
if (response)
{
if (listitem == 0)
{
print("Reached point 4");
PlayerInfo[playerid][pCity] = 0;
SendClientMessage(playerid, COLOR_GREEN, "Okay,So you are from Los Santos");
RegistrationStep[playerid] = 3;
}
if (listitem == 1)
{
print("Reached point 5");
PlayerInfo[playerid][pCity] = 1;
SendClientMessage(playerid, COLOR_GREEN, "Okay,So you are from San Fierro");
RegistrationStep[playerid] = 3;
}
if (listitem == 2)
{
print("Reached point 6");
PlayerInfo[playerid][pCity] = 2;
SendClientMessage(playerid, COLOR_GREEN, "Okay,So you are from Los Venturas");
RegistrationStep[playerid] = 3;
}
if (listitem == 3)
{
print("Reached point 7");
PlayerInfo[playerid][pCity] = 3;
SendClientMessage(playerid, COLOR_GREEN, "Okay,So you are from Liberty City");
RegistrationStep[playerid] = 3;
}
}
print("Reached point 8");
if(RegistrationStep[playerid] == 3)
{
ShowPlayerDialog(playerid, dregister3, DIALOG_STYLE_LIST, "Okay. So choose your fighting style","Normal\nBoxing\nKungFu\nKnee Head\nGrab Kick\nElbow", "Choose", "Cancel");
}
}
SendClientMessageEx(playerid, COLOR_LIGHTRED, "Thanks for filling in all the information, Welcome to Natural Los Santos Role Play.!");
RegistrationStep[playerid] = 0;
SetPlayerVirtualWorld(playerid, 0);
ClearChatbox(playerid);
TutStep[playerid] = 1;
PlayerInfo[playerid][pModel] = ChosenSkin[playerid];
SetPlayerVirtualWorld(playerid,0);
PlayerInfo[playerid][pVW] = 0;
SetPVarInt(playerid, "MedicBill", 0);
SelectCharPlace[playerid] = 0;
SelectCharID[playerid] = 0;
SelectChar[playerid] = 0;
PlayerInfo[playerid][pInt] = 0;
TogglePlayerControllable(playerid,1);
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid, 1715.1201,-1903.1711,13.5665);
SetPlayerFacingAngle(playerid, 359.4621);
SetCameraBehindPlayer(playerid);
}
pawn Код:
public OnPlayerRegister(playerid, password[])
{
if(IsPlayerConnected(playerid))
{
new string3[32];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(string3, sizeof(string3), "users/%s.ini", playername3);
new File: hFile = fopen(string3, io_write);
if (hFile)
{
savingdata
fclose(hFile);
OnPlayerLogin(playerid, password);
SendClientMessageEx(playerid, COLOR_YELLOW, "Account registered, you have been logged in automatically.");
TotalRegister++;
}
}
return 1;
}