13.01.2018, 10:06
Title, I don't see any issues using it..
Full code;
fade.pwn
And this is how I use it:
roleplay.pwn
PHP код:
CallRemoteFunction(return_callback, "i", playerid);
fade.pwn
PHP код:
static PlayerText:playerFadeScreen[MAX_PLAYERS];
SetPlayerToFade(const playerid, const interval, const return_callback[]) {
PlayerTextDrawDestroy(playerid, playerFadeScreen[playerid]);
playerFadeScreen[playerid] = CreatePlayerTextDraw(playerid,0.000000, 0.000000, "_");
PlayerTextDrawBackgroundColor(playerid, playerFadeScreen[playerid], 255);
PlayerTextDrawFont(playerid, playerFadeScreen[playerid], 1);
PlayerTextDrawLetterSize(playerid, playerFadeScreen[playerid], 0.500000, 64.000000);
PlayerTextDrawColor(playerid, playerFadeScreen[playerid], -1);
PlayerTextDrawSetOutline(playerid, playerFadeScreen[playerid], 0);
PlayerTextDrawSetProportional(playerid, playerFadeScreen[playerid], 1);
PlayerTextDrawSetShadow(playerid, playerFadeScreen[playerid], 1);
PlayerTextDrawUseBox(playerid, playerFadeScreen[playerid], 1);
PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000011);
PlayerTextDrawTextSize(playerid, playerFadeScreen[playerid], 640.000000, 0.000000);
PlayerTextDrawSetSelectable(playerid, playerFadeScreen[playerid], 0);
SetTimerEx("@OnPlayerRefreshScreen", interval/20, false, "iiis", playerid, interval/20, 0, return_callback);
}
forward @OnPlayerRefreshScreen(playerid, interval, stage, return_callback);
@OnPlayerRefreshScreen(playerid, interval, stage, return_callback) {
if(stage < 28) {
if(stage == 14)
CallRemoteFunction(return_callback, "i", playerid);
SetTimerEx("@OnPlayerRefreshScreen", interval, false, "iii", playerid, interval, stage+1);
switch(stage) {
case 0: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000011);
case 1: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000022);
case 2: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000033);
case 3: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000044);
case 4: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000055);
case 5: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000066);
case 6: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000077);
case 7: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000088);
case 8: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000099);
case 9: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000AA);
case 10: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000BB);
case 11: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000CC);
case 12: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000DD);
case 13: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000EE);
case 14: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000FF);
case 15: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000EE);
case 16: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000DD);
case 17: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000CC);
case 18: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000BB);
case 19: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x000000AA);
case 20: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000099);
case 21: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000088);
case 22: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000077);
case 23: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000066);
case 24: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000055);
case 25: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000044);
case 26: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000033);
case 27: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000022);
case 28: PlayerTextDrawBoxColor(playerid, playerFadeScreen[playerid], 0x00000011);
}
}
else
PlayerTextDrawDestroy(playerid, playerFadeScreen[playerid]);
}
roleplay.pwn
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
switch(dialogid) {
case DIALOG_LOGIN: {
if(response) {
if(!strempty(inputtext)) {
static password[256];
SHA256_PassHash(inputtext, "removed for samp forums", password, sizeof password);
if(!strcmp(password, playerData[playerid][playerPassword], false)) {
playerData[playerid][playerActive] = true;
SpawnPlayer(playerid);
SetPlayerToFade(playerid, 2000, "OnPlayerFinishFade");
}
else ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Lexus-Gaming: Roleplay", "{A1C1D1}Welcome back,\n please enter your password below to login and play.\n \n"HEXWINE"Your credentials doesn't match up.", "Submit", "Cancel");
}
else ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Lexus-Gaming: Roleplay", "{A1C1D1}Welcome back,\n please enter your password below to login and play.\n \n"HEXWINE"You must enter a password.", "Submit", "Cancel");
}
else {
SendClientMessage(playerid, COLOR_WINE, "You've been kicked for the following reason..");
SendClientMessage(playerid, COLOR_WINE, " - You failed to properly log in to your account.");
KickPlayer(playerid);
}
return 1;
}
}
return 0;
}