// Weapon Textdraw by Me eMapper.
// I Hope YOu'll Enjoy It
// Dont Steal Credits If You Would Go Fuck You're Self
// PacMan game rulze :D
// Comment/Rate It Ya Guys
#include <a_samp>
new Text:Menu, Text:Info, qarms[MAX_PLAYERS], menuArms[MAX_PLAYERS], pickup[6];
forward Arms(playerid);
public OnGameModeInit()
{
Menu = TextDrawCreate(112.000000, 113.000000, "~n~Weapon Menu~n~~n~9mm~n~Shotgun~n~MP5~n~AK-47~n~M4~n~Sawn-off~n~_");
TextDrawAlignment(Menu, 2);
TextDrawBackgroundColor(Menu, 255);
TextDrawFont(Menu, 2);
TextDrawLetterSize(Menu, 0.360000, 1.000000);
TextDrawColor(Menu, -1);
TextDrawSetOutline(Menu, 1);
TextDrawSetProportional(Menu, 1);
TextDrawUseBox(Menu, 1);
TextDrawBoxColor(Menu, 336870460);
TextDrawTextSize(Menu, 856.000000, 178.000000);
Info = TextDrawCreate(256.000000, 127.000000, "INFORMATION~n~~n~Name X~n~ID X~n~ Price $X");
TextDrawAlignment(Info, 2);
TextDrawBackgroundColor(Info, 255);
TextDrawFont(Info, 2);
TextDrawLetterSize(Info, 0.330000, 0.899999);
TextDrawColor(Info, -1);
TextDrawSetOutline(Info, 1);
TextDrawSetProportional(Info, 1);
TextDrawUseBox(Info, 1);
TextDrawBoxColor(Info, 336870460);
TextDrawTextSize(Info, 42.000000, -110.000000);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/arms", cmdtext, true) == 0)
{
qarms[playerid] = 0;
menuArms[playerid] = 1;
TextDrawShowForPlayer(playerid, Menu);
TextDrawShowForPlayer(playerid, Info);
return 1;
}
return 0;
}
public Arms(playerid)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
if(qarms[playerid] == 1)
{
DestroyPickup(pickup[1]);
DestroyPickup(pickup[2]);
DestroyPickup(pickup[3]);
DestroyPickup(pickup[4]);
DestroyPickup(pickup[5]);
pickup[0] = CreatePickup(348, 2, X+2,Y+2,Z, GetPlayerVirtualWorld(playerid));
TextDrawSetString(Menu, "~n~Weapon Menu~n~~n~~g~9mm~n~~w~Shotgun~n~MP5~n~AK-47~n~M4~n~Sawn-off~n~_");
TextDrawSetString(Info,"INFORMATION~n~~n~Name 9MM~n~ID 22~n~Price $50");
}
if(qarms[playerid] == 2)
{
DestroyPickup(pickup[0]);
DestroyPickup(pickup[2]);
DestroyPickup(pickup[3]);
DestroyPickup(pickup[4]);
DestroyPickup(pickup[5]);
pickup[1] = CreatePickup(349, 2, X+2,Y+2,Z,GetPlayerVirtualWorld(playerid));
TextDrawSetString(Menu, "~n~Weapon Menu~n~~n~9mm~n~~g~Shotgun~n~~w~MP5~n~AK-47~n~M4~n~Sawn-off~n~_");
TextDrawSetString(Info,"INFORMATION~n~~n~Name Shotgun~n~ID 25~n~Price $250");
}
if(qarms[playerid] == 3)
{
DestroyPickup(pickup[1]);
DestroyPickup(pickup[0]);
DestroyPickup(pickup[3]);
DestroyPickup(pickup[4]);
DestroyPickup(pickup[5]);
pickup[2] = CreatePickup(353, 2, X+2,Y+2,Z,GetPlayerVirtualWorld(playerid));
TextDrawSetString(Menu, "~n~Weapon Menu~n~~n~9mm~n~Shotgun~n~~g~MP5~n~~w~AK-47~n~M4~n~Sawn-off~n~_");
TextDrawSetString(Info,"INFORMATION~n~~n~Name MP5~n~ID 29~n~Price $260");
}
if(qarms[playerid] == 4)
{
DestroyPickup(pickup[1]);
DestroyPickup(pickup[2]);
DestroyPickup(pickup[0]);
DestroyPickup(pickup[4]);
DestroyPickup(pickup[5]);
pickup[3] = CreatePickup(355, 2, X+2,Y+2,Z,GetPlayerVirtualWorld(playerid));
TextDrawSetString(Menu, "~n~Weapon Menu~n~~n~9mm~n~Shotgun~n~MP5~n~~g~AK-47~n~~w~M4~n~Sawn-off~n~_");
TextDrawSetString(Info,"INFORMATION~n~~n~Name AK-47~n~ID 30~n~Price $350");
}
if(qarms[playerid] == 5)
{
DestroyPickup(pickup[1]);
DestroyPickup(pickup[2]);
DestroyPickup(pickup[3]);
DestroyPickup(pickup[0]);
DestroyPickup(pickup[5]);
pickup[4] = CreatePickup(356, 2, X+2,Y+2,Z,GetPlayerVirtualWorld(playerid));
TextDrawSetString(Menu, "~n~Weapon Menu~n~~n~9mm~n~Shotgun~n~MP5~n~AK-47~n~~g~M4~n~~w~Sawn-off~n~_");
TextDrawSetString(Info,"INFORMATION~n~~n~Name M4~n~ID 31~n~Price $360");
}
if(qarms[playerid] == 6)
{
DestroyPickup(pickup[1]);
DestroyPickup(pickup[2]);
DestroyPickup(pickup[3]);
DestroyPickup(pickup[4]);
DestroyPickup(pickup[0]);
pickup[5] = CreatePickup(350, 2, X+2,Y+2,Z,GetPlayerVirtualWorld(playerid));
TextDrawSetString(Menu, "~n~Weapon Menu~n~~n~9mm~n~Shotgun~n~MP5~n~AK-47~n~M4~n~~g~Sawn-off~n~_~w~");
TextDrawSetString(Info,"INFORMATION~n~~n~Name Sawn-off~n~ID 26~n~Price $150");
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(menuArms[playerid] == 1)
{
if (newkeys & KEY_NO)
{
qarms[playerid] ++;
Arms(playerid);
if(qarms[playerid] == 7)
{
qarms[playerid] = 1;
Arms(playerid);
}
}
else if (newkeys & KEY_YES)
{
qarms[playerid] --;
Arms(playerid);
if(qarms[playerid] == 0)
{
qarms[playerid] = 6;Arms(playerid);
}
}
else if (newkeys & 16)
{
if(qarms[playerid] == 1){GivePlayerMoney(playerid, -50);GivePlayerWeapon(playerid,22,500);}
if(qarms[playerid] == 2){GivePlayerMoney(playerid, -250);GivePlayerWeapon(playerid,25,500);}
if(qarms[playerid] == 3){GivePlayerMoney(playerid, -260);GivePlayerWeapon(playerid,29,500);}
if(qarms[playerid] == 4){GivePlayerMoney(playerid, -350);GivePlayerWeapon(playerid,30,500);}
if(qarms[playerid] == 5){GivePlayerMoney(playerid, -360);GivePlayerWeapon(playerid,31,500);}
if(qarms[playerid] == 6){GivePlayerMoney(playerid, -50);GivePlayerWeapon(playerid,26,500);}
}
else if (newkeys & 8)
{
TextDrawHideForPlayer(playerid, Menu);
TextDrawHideForPlayer(playerid, Info);
qarms[playerid] = 0;
menuArms[playerid] = 0;
DestroyPickup(pickup[0]);DestroyPickup(pickup[1]);DestroyPickup(pickup[2]);DestroyPickup(pickup[3]);DestroyPickup(pickup[4]);DestroyPickup(pickup[5]);
}
}
return 1;
}
Simple and good. But would be more better if the textdraw was clickable.
|