open.mp forum
[Library] Textdraw Actions - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Releases (https://forum.open.mp/forumdisplay.php?fid=13)
---- Forum: Libraries (https://forum.open.mp/forumdisplay.php?fid=31)
---- Thread: [Library] Textdraw Actions (/showthread.php?tid=1856)



Textdraw Actions - ForT - 2021-04-10

Textdraw Actions



A simple include that shows a small action box in the center of the screen with options Y and N for the player to choose.



Download

https://github.com/dimmyi/td-actions



Preview:

Image: https://i.imgur.com/90W43SI.png

[Image: 8VQLmcn.gif]



Usage:

PHP Code:
#include <td-actions>



CMD:infernus(playerid)

{

? ? 
ShowActionForPlayer(playeridActionInfernus"Do you really want to spawn a infernus in this position?", .action_time 10000);



? ? return 
1;

}



Action:ActionInfernus(playeridresponse)

{

? ? if (
response == ACTION_RESPONSE_YES)

? ? {

? ? ? ? new 
Float:xFloat:yFloat:zFloat:ang;



? ? ? ? 
GetPlayerPos(playeridxyz);

? ? ? ? 
GetPlayerFacingAngle(playeridang);



? ? ? ? new 
vehicleid CreateVehicle(411,

? ? ? ? ? ? 
x  2.5 floatsin(-angdegrees),

? ? ? ? ? ? 
y  2.5 floatcos(-angdegrees),

? ? ? ? ? ? 
z  0.3,

? ? ? ? ? ? 
ang,

? ? ? ? ? ? 
0,

? ? ? ? ? ? 
0,

? ? ? ? ? ? -
1);



? ? ? ? 
LinkVehicleToInterior(vehicleidGetPlayerInterior(playerid));

? ? ? ? 
SetVehicleVirtualWorld(vehicleidGetPlayerVirtualWorld(playerid));

? ? } else {

? ? ? ? 
SendClientMessage(playerid, -1"You didn't want to spawn a infernus.");

? ? }





Responses:

  1. ACTION_RESPONSE_NO_CHOOSE - When the player does not choose an option

  2. ACTION_RESPONSE_NO -?When the player presses the N key

  3. ACTION_RESPONSE_YES -?When the player presses the Y?key




RE: Textdraw Actions - Awide - 2021-04-10

This looks great man! Good job.


RE: Textdraw Actions - Freaksken - 2021-04-10

Nice!


RE: Textdraw Actions - Snow - 2021-04-10

This looks pretty cool. Good job.


RE: Textdraw Actions - Fawkes - 2021-04-12

Very nice, this would work really well for voting systems and polls too