Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- new Text:TextDrawBuyCars[10],
- PlayerText:TextDrawBuyCarsPlayer[MAX_PLAYERS][3],
- SeeCar[MAX_PLAYERS];
- stock VehicleAvailable[][] =
- {
- {0, 0, "Desconocido"},
- {2000, 451, "Turismo"},
- {5000, 412, "Savana"},
- {6000, 445, "Admiral"},
- {7000, 541, "Bullet"},
- {4500, 467, "Oceanic"}
- };
- public OnFilterScriptInit()
- {
- TextDrawBuyCars[0] = TextDrawCreate(651.000000, -10.000000, "_");
- TextDrawBackgroundColor(TextDrawBuyCars[0], 255);
- TextDrawFont(TextDrawBuyCars[0], 1);
- TextDrawLetterSize(TextDrawBuyCars[0], 0.400000, 51.000000);
- TextDrawColor(TextDrawBuyCars[0], -1);
- TextDrawSetOutline(TextDrawBuyCars[0], 0);
- TextDrawSetProportional(TextDrawBuyCars[0], 1);
- TextDrawSetShadow(TextDrawBuyCars[0], 1);
- TextDrawUseBox(TextDrawBuyCars[0], 1);
- TextDrawBoxColor(TextDrawBuyCars[0], 255);
- TextDrawTextSize(TextDrawBuyCars[0], -21.000000, 0.000000);
- TextDrawSetSelectable(TextDrawBuyCars[0], 0);
- TextDrawBuyCars[1] = TextDrawCreate(651.000000, 447.000000, "_");
- TextDrawBackgroundColor(TextDrawBuyCars[1], 255);
- TextDrawFont(TextDrawBuyCars[1], 1);
- TextDrawLetterSize(TextDrawBuyCars[1], 0.400000, 3.699998);
- TextDrawColor(TextDrawBuyCars[1], -1);
- TextDrawSetOutline(TextDrawBuyCars[1], 0);
- TextDrawSetProportional(TextDrawBuyCars[1], 1);
- TextDrawSetShadow(TextDrawBuyCars[1], 1);
- TextDrawUseBox(TextDrawBuyCars[1], 1);
- TextDrawBoxColor(TextDrawBuyCars[1], -16776961);
- TextDrawTextSize(TextDrawBuyCars[1], -21.000000, 0.000000);
- TextDrawSetSelectable(TextDrawBuyCars[1], 0);
- TextDrawBuyCars[2] = TextDrawCreate(60.000000, 50.000000, "VEHICLES SELECTION");
- TextDrawBackgroundColor(TextDrawBuyCars[2], 255);
- TextDrawFont(TextDrawBuyCars[2], 1);
- TextDrawLetterSize(TextDrawBuyCars[2], 0.600000, 4.000000);
- TextDrawColor(TextDrawBuyCars[2], -1);
- TextDrawSetOutline(TextDrawBuyCars[2], 0);
- TextDrawSetProportional(TextDrawBuyCars[2], 1);
- TextDrawSetShadow(TextDrawBuyCars[2], 1);
- TextDrawSetSelectable(TextDrawBuyCars[2], 0);
- TextDrawBuyCars[3] = TextDrawCreate(651.000000, -33.000000, "_");
- TextDrawBackgroundColor(TextDrawBuyCars[3], 255);
- TextDrawFont(TextDrawBuyCars[3], 1);
- TextDrawLetterSize(TextDrawBuyCars[3], 0.400000, 3.699998);
- TextDrawColor(TextDrawBuyCars[3], -1);
- TextDrawSetOutline(TextDrawBuyCars[3], 0);
- TextDrawSetProportional(TextDrawBuyCars[3], 1);
- TextDrawSetShadow(TextDrawBuyCars[3], 1);
- TextDrawUseBox(TextDrawBuyCars[3], 1);
- TextDrawBoxColor(TextDrawBuyCars[3], -16776961);
- TextDrawTextSize(TextDrawBuyCars[3], -21.000000, 0.000000);
- TextDrawSetSelectable(TextDrawBuyCars[3], 0);
- TextDrawBuyCars[4] = TextDrawCreate(87.000000, 397.000000, "~G~BUY");
- TextDrawAlignment(TextDrawBuyCars[4], 2);
- TextDrawBackgroundColor(TextDrawBuyCars[4], 255);
- TextDrawFont(TextDrawBuyCars[4], 3);
- TextDrawLetterSize(TextDrawBuyCars[4], 0.730000, 3.299999);
- TextDrawColor(TextDrawBuyCars[4], -1);
- TextDrawSetOutline(TextDrawBuyCars[4], 1);
- TextDrawSetProportional(TextDrawBuyCars[4], 1);
- TextDrawTextSize(TextDrawBuyCars[4], 30.000000, 30.000000);
- TextDrawSetSelectable(TextDrawBuyCars[4], true);
- TextDrawBuyCars[5] = TextDrawCreate(581.000000, 398.000000, "~R~EXIT");
- TextDrawAlignment(TextDrawBuyCars[5], 2);
- TextDrawBackgroundColor(TextDrawBuyCars[5], 255);
- TextDrawFont(TextDrawBuyCars[5], 3);
- TextDrawLetterSize(TextDrawBuyCars[5], 0.730000, 3.299999);
- TextDrawColor(TextDrawBuyCars[5], -1);
- TextDrawSetOutline(TextDrawBuyCars[5], 1);
- TextDrawSetProportional(TextDrawBuyCars[5], 1);
- TextDrawTextSize(TextDrawBuyCars[5], 30.000000, 30.000000);
- TextDrawSetSelectable(TextDrawBuyCars[5], true);
- TextDrawBuyCars[6] = TextDrawCreate(409.000000, 88.000000, "Use the arrows on the screen to move!");
- TextDrawAlignment(TextDrawBuyCars[6], 2);
- TextDrawBackgroundColor(TextDrawBuyCars[6], 255);
- TextDrawFont(TextDrawBuyCars[6], 2);
- TextDrawLetterSize(TextDrawBuyCars[6], 0.220000, 1.800000);
- TextDrawColor(TextDrawBuyCars[6], -1);
- TextDrawSetOutline(TextDrawBuyCars[6], 0);
- TextDrawSetProportional(TextDrawBuyCars[6], 1);
- TextDrawSetShadow(TextDrawBuyCars[6], 1);
- TextDrawSetSelectable(TextDrawBuyCars[6], 0);
- TextDrawBuyCars[7] = TextDrawCreate(471.000000, 274.000000, "~>~");
- TextDrawAlignment(TextDrawBuyCars[7], 2);
- TextDrawBackgroundColor(TextDrawBuyCars[7], 255);
- TextDrawFont(TextDrawBuyCars[7], 1);
- TextDrawLetterSize(TextDrawBuyCars[7], 0.800000, 4.000000);
- TextDrawColor(TextDrawBuyCars[7], -1);
- TextDrawSetOutline(TextDrawBuyCars[7], 0);
- TextDrawSetProportional(TextDrawBuyCars[7], 1);
- TextDrawSetShadow(TextDrawBuyCars[7], 1);
- TextDrawTextSize(TextDrawBuyCars[7], 35.000000, 35.000000);
- TextDrawSetSelectable(TextDrawBuyCars[7], true);
- TextDrawBuyCars[8] = TextDrawCreate(173.000000, 276.000000, "~<~");
- TextDrawAlignment(TextDrawBuyCars[8], 2);
- TextDrawBackgroundColor(TextDrawBuyCars[8], 255);
- TextDrawFont(TextDrawBuyCars[8], 1);
- TextDrawLetterSize(TextDrawBuyCars[8], 0.800000, 4.000000);
- TextDrawColor(TextDrawBuyCars[8], -1);
- TextDrawSetOutline(TextDrawBuyCars[8], 0);
- TextDrawSetProportional(TextDrawBuyCars[8], 1);
- TextDrawSetShadow(TextDrawBuyCars[8], 1);
- TextDrawTextSize(TextDrawBuyCars[8], 40.000000, 40.000000);
- TextDrawSetSelectable(TextDrawBuyCars[8], true);
- TextDrawBuyCars[9] = TextDrawCreate(541.000000, 89.000000, "_");
- TextDrawBackgroundColor(TextDrawBuyCars[9], 255);
- TextDrawFont(TextDrawBuyCars[9], 1);
- TextDrawLetterSize(TextDrawBuyCars[9], 0.400000, -0.300001);
- TextDrawColor(TextDrawBuyCars[9], -1);
- TextDrawSetOutline(TextDrawBuyCars[9], 0);
- TextDrawSetProportional(TextDrawBuyCars[9], 1);
- TextDrawSetShadow(TextDrawBuyCars[9], 1);
- TextDrawUseBox(TextDrawBuyCars[9], 1);
- TextDrawBoxColor(TextDrawBuyCars[9], -16776961);
- TextDrawTextSize(TextDrawBuyCars[9], 59.000000, 0.000000);
- TextDrawSetSelectable(TextDrawBuyCars[9], 0);
- return 1;
- }
- public OnPlayerClickTextDraw(playerid, Text:clickedid)
- {
- new string[128];
- if(_:clickedid != INVALID_TEXT_DRAW)
- {
- if(clickedid == TextDrawBuyCars[4]) // COMPRAR
- {
- #define Distancia 2.0
- new Float:APosX,Float:APosY,Float:APosZ;
- #pragma unused APosX
- #pragma unused APosY
- GetPlayerPos(playerid, APosX, APosY, APosZ);
- new Float:Pos[3]; /* 0: X - 1: Y - 2: A - */
- GetPlayerPos(playerid, Pos[0], Pos[1], APosZ);
- GetPlayerFacingAngle(playerid, Pos[2]);
- if(GetPlayerVehicleID(playerid))
- {
- GetVehicleZAngle(GetPlayerVehicleID(playerid), Pos[2]);
- }
- Pos[0] += (Distancia * floatsin(-Pos[2], degrees));
- Pos[1] += (Distancia * floatcos(-Pos[2], degrees));
- CreateVehicle(VehicleAvailable[SeeCar[playerid]][1], Pos[0] , Pos[1], APosZ, 0.0, 0, 0, 60000);
- for(new Dibujos = 0; Dibujos < 3; Dibujos++){
- PlayerTextDrawHide(playerid, TextDrawBuyCarsPlayer[playerid][Dibujos]);
- }
- for (new Dibujos = 0; Dibujos < 10; Dibujos++){
- TextDrawHideForPlayer(playerid, TextDrawBuyCars[Dibujos]);
- }
- SeeCar[playerid] = 0;
- CancelSelectTextDraw(playerid);
- SendClientMessage(playerid, -1, "You have a new car!");
- }
- else if(clickedid == TextDrawBuyCars[5]) // SALIR
- {
- for(new Dibujos = 0; Dibujos < 3; Dibujos++){
- PlayerTextDrawHide(playerid, TextDrawBuyCarsPlayer[playerid][Dibujos]);
- }
- for (new Dibujos = 0; Dibujos < 10; Dibujos++){
- TextDrawHideForPlayer(playerid, TextDrawBuyCars[Dibujos]);
- }
- SeeCar[playerid] = 0;
- CancelSelectTextDraw(playerid);
- SendClientMessage(playerid, -1, "You have not bought anything!");
- }
- else if(clickedid == TextDrawBuyCars[7]) // >
- {
- if(SeeCar[playerid] > sizeof(VehicleAvailable)-1) return SendClientMessage(playerid, -1, "No more cars!");
- SeeCar[playerid]++;
- format(string, sizeof(string), "~W~Price: ~R~$%d", VehicleAvailable[SeeCar[playerid]][0]);
- PlayerTextDrawSetString(playerid, TextDrawBuyCarsPlayer[playerid][0], string);
- PlayerTextDrawSetPreviewModel(playerid, TextDrawBuyCarsPlayer[playerid][1], VehicleAvailable[SeeCar[playerid]][1]);
- format(string, sizeof(string), "%s", VehicleAvailable[SeeCar[playerid]][2]);
- PlayerTextDrawSetString(playerid, TextDrawBuyCarsPlayer[playerid][2], string);
- for(new Dibujos = 0; Dibujos < 3; Dibujos++)
- {
- PlayerTextDrawShow(playerid, TextDrawBuyCarsPlayer[playerid][Dibujos]);
- }
- }
- else if(clickedid == TextDrawBuyCars[8]) // <
- {
- if(SeeCar[playerid] <= 1) return SendClientMessage(playerid, -1, "No more cars!");
- SeeCar[playerid]--;
- format(string, sizeof(string), "~W~Price: ~R~$%d", VehicleAvailable[SeeCar[playerid]][0]);
- PlayerTextDrawSetString(playerid, TextDrawBuyCarsPlayer[playerid][0], string);
- PlayerTextDrawSetPreviewModel(playerid, TextDrawBuyCarsPlayer[playerid][1], VehicleAvailable[SeeCar[playerid]][1]);
- format(string, sizeof(string), "%s", VehicleAvailable[SeeCar[playerid]][2]);
- PlayerTextDrawSetString(playerid, TextDrawBuyCarsPlayer[playerid][2], string);
- for(new Dibujos = 0; Dibujos < 3; Dibujos++)
- {
- PlayerTextDrawShow(playerid, TextDrawBuyCarsPlayer[playerid][Dibujos]);
- }
- }
- }
- return 1;
- }
- main()
- {
- print("\n----------------------------------");
- print(" Blank Gamemode by your name here");
- print("----------------------------------\n");
- }
- public OnPlayerConnect(playerid)
- {
- SeeCar[playerid] = 0;
- TextDrawBuyCarsPlayer[playerid][0] = CreatePlayerTextDraw(playerid,337.000000, 327.000000, "~W~Price: ~R~$50.000");
- PlayerTextDrawAlignment(playerid,TextDrawBuyCarsPlayer[playerid][0], 2);
- PlayerTextDrawBackgroundColor(playerid,TextDrawBuyCarsPlayer[playerid][0], 255);
- PlayerTextDrawFont(playerid,TextDrawBuyCarsPlayer[playerid][0], 3);
- PlayerTextDrawLetterSize(playerid,TextDrawBuyCarsPlayer[playerid][0], 0.730000, 3.299999);
- PlayerTextDrawColor(playerid,TextDrawBuyCarsPlayer[playerid][0], -1);
- PlayerTextDrawSetOutline(playerid,TextDrawBuyCarsPlayer[playerid][0], 1);
- PlayerTextDrawSetProportional(playerid,TextDrawBuyCarsPlayer[playerid][0], 1);
- PlayerTextDrawSetSelectable(playerid,TextDrawBuyCarsPlayer[playerid][0], 0);
- TextDrawBuyCarsPlayer[playerid][1] = CreatePlayerTextDraw(playerid,257.000000, 101.000000, "412");
- PlayerTextDrawBackgroundColor(playerid,TextDrawBuyCarsPlayer[playerid][1], 255);
- PlayerTextDrawFont(playerid,TextDrawBuyCarsPlayer[playerid][1], 5);
- PlayerTextDrawLetterSize(playerid,TextDrawBuyCarsPlayer[playerid][1], 0.700000, 12.000000);
- PlayerTextDrawColor(playerid,TextDrawBuyCarsPlayer[playerid][1], -1);
- PlayerTextDrawSetOutline(playerid,TextDrawBuyCarsPlayer[playerid][1], 0);
- PlayerTextDrawSetProportional(playerid,TextDrawBuyCarsPlayer[playerid][1], 1);
- PlayerTextDrawSetShadow(playerid,TextDrawBuyCarsPlayer[playerid][1], 1);
- PlayerTextDrawUseBox(playerid,TextDrawBuyCarsPlayer[playerid][1], 1);
- PlayerTextDrawBoxColor(playerid,TextDrawBuyCarsPlayer[playerid][1], 255);
- PlayerTextDrawTextSize(playerid,TextDrawBuyCarsPlayer[playerid][1], 160.000000, 210.000000);
- PlayerTextDrawSetPreviewModel(playerid, TextDrawBuyCarsPlayer[playerid][1], 412);
- PlayerTextDrawSetPreviewRot(playerid, TextDrawBuyCarsPlayer[playerid][1], -16.000000, 0.000000, -55.000000, 1.000000);
- PlayerTextDrawSetSelectable(playerid,TextDrawBuyCarsPlayer[playerid][1], 0);
- TextDrawBuyCarsPlayer[playerid][2] = CreatePlayerTextDraw(playerid,339.000000, 282.000000, "GREENWOOD");
- PlayerTextDrawAlignment(playerid,TextDrawBuyCarsPlayer[playerid][2], 2);
- PlayerTextDrawBackgroundColor(playerid,TextDrawBuyCarsPlayer[playerid][2], 255);
- PlayerTextDrawFont(playerid,TextDrawBuyCarsPlayer[playerid][2], 3);
- PlayerTextDrawLetterSize(playerid,TextDrawBuyCarsPlayer[playerid][2], 0.549999, 2.800000);
- PlayerTextDrawColor(playerid,TextDrawBuyCarsPlayer[playerid][2], -1);
- PlayerTextDrawSetOutline(playerid,TextDrawBuyCarsPlayer[playerid][2], 1);
- PlayerTextDrawSetProportional(playerid,TextDrawBuyCarsPlayer[playerid][2], 1);
- PlayerTextDrawSetSelectable(playerid,TextDrawBuyCarsPlayer[playerid][2], 0);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- for(new Dibujos = 0; Dibujos < 3; Dibujos++){ PlayerTextDrawDestroy(playerid, TextDrawBuyCarsPlayer[playerid][Dibujos]); }
- return 1;
- }
- public OnFilterScriptExit()
- {
- for (new Dibujos = 0; Dibujos < 10; Dibujos++) { TextDrawDestroy(TextDrawBuyCars[Dibujos]); }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/vehicles", cmdtext, true, 10) == 0)
- {
- new string[64];
- SeeCar[playerid] = 1;
- format(string, sizeof(string), "~W~Price: ~R~$%d", VehicleAvailable[SeeCar[playerid]][0]);
- PlayerTextDrawSetString(playerid, TextDrawBuyCarsPlayer[playerid][0], string);
- PlayerTextDrawSetPreviewModel(playerid, TextDrawBuyCarsPlayer[playerid][1], VehicleAvailable[SeeCar[playerid]][1]);
- format(string, sizeof(string), "%s", VehicleAvailable[SeeCar[playerid]][2]);
- PlayerTextDrawSetString(playerid, TextDrawBuyCarsPlayer[playerid][2], string);
- for(new x = 0; x < 3; x++) { PlayerTextDrawShow(playerid, TextDrawBuyCarsPlayer[playerid][x]); }
- for(new Dibujos = 0; Dibujos < 10; Dibujos++) { TextDrawShowForPlayer(playerid, TextDrawBuyCars[Dibujos]); }
- for(new i = 0; i < 10; i++) { SendClientMessage(playerid,-1, " "); }
- SelectTextDraw(playerid, 0xFFA800FF);
- return 1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement