04.11.2012, 20:32
Hey I am making a new GM and I was making a little introductory tutorial, here is the text draws and the code to go forward a slide using the space bar. The problem is after I press space once, it removes all textdraws except the two boxes that are at the bottom of the screen.
Text draws:
Here is the keystatechange callback:
And the first slide is shown here:
Any help is greatly appreciated.
Text draws:
pawn Код:
public OnGameModeInit()
{
SetGameModeText("Spectral Cops & Robbers");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
Textdraw0 = TextDrawCreate(643.000000, 427.000000, "New textdraw");
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.500000, 1.000000);
TextDrawColor(Textdraw0, -1);
TextDrawSetOutline(Textdraw0, 0);
TextDrawSetProportional(Textdraw0, 0);
TextDrawSetShadow(Textdraw0, 1);
TextDrawUseBox(Textdraw0, 1);
TextDrawBoxColor(Textdraw0, 255);
TextDrawTextSize(Textdraw0, -24.000000, 410.000000);
Textdraw1 = TextDrawCreate(643.000000, 403.000000, "New Textdraw");
TextDrawBackgroundColor(Textdraw1, 255);
TextDrawFont(Textdraw1, 1);
TextDrawLetterSize(Textdraw1, 0.500000, 1.000000);
TextDrawColor(Textdraw1, -1);
TextDrawSetOutline(Textdraw1, 0);
TextDrawSetProportional(Textdraw1, 0);
TextDrawSetShadow(Textdraw1, 1);
TextDrawUseBox(Textdraw1, 1);
TextDrawBoxColor(Textdraw1, 255);
TextDrawTextSize(Textdraw1, -24.000000, 410.000000);
Textdraw2 = TextDrawCreate(643.000000, 2.000000, "New Textdraw");
TextDrawBackgroundColor(Textdraw2, 255);
TextDrawFont(Textdraw2, 1);
TextDrawLetterSize(Textdraw2, 0.500000, 1.000000);
TextDrawColor(Textdraw2, -1);
TextDrawSetOutline(Textdraw2, 0);
TextDrawSetProportional(Textdraw2, 0);
TextDrawSetShadow(Textdraw2, 1);
TextDrawUseBox(Textdraw2, 1);
TextDrawBoxColor(Textdraw2, 255);
TextDrawTextSize(Textdraw2, -24.000000, 410.000000);
Textdraw3 = TextDrawCreate(643.000000, 26.000000, "New textdraw");
TextDrawBackgroundColor(Textdraw3, 255);
TextDrawFont(Textdraw3, 1);
TextDrawLetterSize(Textdraw3, 0.500000, 1.000000);
TextDrawColor(Textdraw3, -1);
TextDrawSetOutline(Textdraw3, 0);
TextDrawSetProportional(Textdraw3, 0);
TextDrawSetShadow(Textdraw3, 1);
TextDrawUseBox(Textdraw3, 1);
TextDrawBoxColor(Textdraw3, 255);
TextDrawTextSize(Textdraw3, -24.000000, 410.000000);
Textdraw4 = TextDrawCreate(10.000000, 409.000000, "Welcome to Spectral Cops and Robbers!");
TextDrawBackgroundColor(Textdraw4, 65535);
TextDrawFont(Textdraw4, 3);
TextDrawLetterSize(Textdraw4, 0.529999, 1.500000);
TextDrawColor(Textdraw4, 16777215);
TextDrawSetOutline(Textdraw4, 1);
TextDrawSetProportional(Textdraw4, 1);
Textdraw5 = TextDrawCreate(294.000000, 432.000000, "Press space to go forward.");
TextDrawBackgroundColor(Textdraw5, 255);
TextDrawFont(Textdraw5, 2);
TextDrawLetterSize(Textdraw5, 0.380000, 1.000000);
TextDrawColor(Textdraw5, -1);
TextDrawSetOutline(Textdraw5, 0);
TextDrawSetProportional(Textdraw5, 1);
TextDrawSetShadow(Textdraw5, 1);
Textdraw6 = TextDrawCreate(10.000000, 409.000000, "This is where the cops spawn!");
TextDrawBackgroundColor(Textdraw6, 65535);
TextDrawFont(Textdraw6, 3);
TextDrawLetterSize(Textdraw6, 0.529999, 1.500000);
TextDrawColor(Textdraw6, 16777215);
TextDrawSetOutline(Textdraw6, 1);
TextDrawSetProportional(Textdraw6, 1);
Textdraw7 = TextDrawCreate(10.000000, 409.000000, "The robbers spawn at the airport!");
TextDrawBackgroundColor(Textdraw7, 65535);
TextDrawFont(Textdraw7, 3);
TextDrawLetterSize(Textdraw7, 0.529999, 1.500000);
TextDrawColor(Textdraw7, 16777215);
TextDrawSetOutline(Textdraw7, 1);
TextDrawSetProportional(Textdraw7, 1);
Textdraw8 = TextDrawCreate(10.000000, 409.000000, "If you die you spawn here, if you are wanted the cops will know!");
TextDrawBackgroundColor(Textdraw8, 65535);
TextDrawFont(Textdraw8, 3);
TextDrawLetterSize(Textdraw8, 0.529999, 1.500000);
TextDrawColor(Textdraw8, 16777215);
TextDrawSetOutline(Textdraw8, 1);
TextDrawSetProportional(Textdraw8, 1);
Textdraw9 = TextDrawCreate(10.000000, 409.000000, "Finally, you can rob business to earn cash!");
TextDrawBackgroundColor(Textdraw9, 65535);
TextDrawFont(Textdraw9, 3);
TextDrawLetterSize(Textdraw9, 0.529999, 1.500000);
TextDrawColor(Textdraw9, 16777215);
TextDrawSetOutline(Textdraw9, 1);
TextDrawSetProportional(Textdraw9, 1);
return 1;
}
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys & KEY_SPRINT) && !(oldkeys & KEY_SPRINT))
{
if(InTutorial[playerid] == 1)
{
if(TutorialSlide[playerid] == 1)
{
TextDrawHideForPlayer(playerid, Textdraw4);
TextDrawShowForPlayer(playerid, Textdraw6);
SetPlayerCameraPos(playerid, 1503.4584, -1651.6173, 36.8625);
SetPlayerCameraLookAt(playerid, 1503.4584, -1651.6173, 36.862);
SetPlayerFacingAngle(playerid, 287.9191);
TutorialSlide[playerid] ++;
}
if(TutorialSlide[playerid] == 2)
{
TextDrawHideForPlayer(playerid, Textdraw6);
TextDrawShowForPlayer(playerid, Textdraw7);
SetPlayerCameraPos(playerid, 1580.3230, -2130.1387, 83.9707);
SetPlayerCameraLookAt(playerid, 1580.3230, -2130.1387, 83.9707);
SetPlayerFacingAngle(playerid, 200.5651);
TutorialSlide[playerid] ++;
}
if(TutorialSlide[playerid] == 3)
{
TextDrawHideForPlayer(playerid, Textdraw7);
TextDrawShowForPlayer(playerid, Textdraw8);
SetPlayerCameraPos(playerid, 1208.7789, -1337.0931, 25.2644);
SetPlayerCameraLookAt(playerid, 1208.7789, -1337.0931, 25.2644);
SetPlayerFacingAngle(playerid, 67.3297);
TutorialSlide[playerid] ++;
}
if(TutorialSlide[playerid] == 4)
{
TextDrawHideForPlayer(playerid, Textdraw8);
TextDrawShowForPlayer(playerid, Textdraw9);
SetPlayerCameraPos(playerid, 908.0220, -1347.0223, 22.4175);
SetPlayerCameraLookAt(playerid, 908.0220, -1347.0223, 22.4175);
SetPlayerFacingAngle(playerid, 257.8388);
TutorialSlide[playerid] ++;
}
if(TutorialSlide[playerid] == 5)
{
TextDrawHideForPlayer(playerid, Textdraw1);
TextDrawHideForPlayer(playerid, Textdraw2);
TextDrawHideForPlayer(playerid, Textdraw3);
TextDrawHideForPlayer(playerid, Textdraw4);
TextDrawHideForPlayer(playerid, Textdraw5);
TextDrawHideForPlayer(playerid, Textdraw6);
TextDrawHideForPlayer(playerid, Textdraw7);
TextDrawHideForPlayer(playerid, Textdraw8);
TextDrawHideForPlayer(playerid, Textdraw9);
SetCameraBehindPlayer(playerid);
TutorialSlide[playerid] = 0;
InTutorial[playerid] = 0;
}
}
}
return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
if(InTutorial[playerid] == 1)
{
TutorialSlide[playerid] = 1;
TextDrawShowForPlayer(playerid, Textdraw0);
TextDrawShowForPlayer(playerid, Textdraw1);
TextDrawShowForPlayer(playerid, Textdraw2);
TextDrawShowForPlayer(playerid, Textdraw3);
TextDrawShowForPlayer(playerid, Textdraw4);
TextDrawShowForPlayer(playerid, Textdraw5);
SetPlayerCameraPos(playerid, 1414.2582, -1657.5881, 45.7698);
SetPlayerCameraLookAt(playerid, 1414.2582, -1657.5881, 45.7698);
SetPlayerFacingAngle(playerid, 283.8458);
return 1;
}
return 1;
}