10.12.2017, 18:29
Hello,
I am trying to make textdraw which will show current weapon player is holding.
But the problem is, when I enter the game I can only see how much ammo I have, wepaon textdraw is full black
Code:
I am trying to make textdraw which will show current weapon player is holding.
But the problem is, when I enter the game I can only see how much ammo I have, wepaon textdraw is full black
Code:
Код:
new PlayerText:playerweapon[MAX_PLAYERS]; new PlayerText:playerammo[MAX_PLAYERS]; public OnPlayerSpawn(playerid) { PlayerTextDrawShow(playerid,playerweapon[playerid]); PlayerTextDrawShow(playerid,playerammo[playerid]); } public OnPlayerDisconnect(playerid) { PlayerTextDrawHide(playerid,playerweapon[playerid]); PlayerTextDrawDestroy(playerid,playerweapon[playerid]); PlayerTextDrawHide(playerid,playerammo[playerid]); PlayerTextDrawDestroy(playerid,playerammo[playerid]); } stock CreatePlayerTD(playerid) // under onplayerconnect { playerweapon[playerid] = CreatePlayerTextDraw(playerid, 521.500000, 70.000000, "."); PlayerTextDrawLetterSize(playerid, playerweapon[playerid], 0.449999, 1.600000); PlayerTextDrawAlignment(playerid, playerweapon[playerid], 1); PlayerTextDrawColor(playerid, playerweapon[playerid], -1); PlayerTextDrawSetShadow(playerid, playerweapon[playerid], 0); PlayerTextDrawSetOutline(playerid, playerweapon[playerid], 1); PlayerTextDrawFont(playerid, playerweapon[playerid], TEXT_DRAW_FONT_MODEL_PREVIEW); PlayerTextDrawSetPreviewModel(playerid, playerweapon[playerid], 325135); playerammo[playerid] = CreatePlayerTextDraw(playerid, 564.500000, 72.916648, "Ammo: 0"); PlayerTextDrawLetterSize(playerid, playerammo[playerid], 0.287000, 1.430833); PlayerTextDrawAlignment(playerid, playerammo[playerid], 1); PlayerTextDrawColor(playerid, playerammo[playerid], -1); PlayerTextDrawSetShadow(playerid, playerammo[playerid], 0); PlayerTextDrawSetOutline(playerid, playerammo[playerid], 1); PlayerTextDrawBackgroundColor(playerid, playerammo[playerid], 255); PlayerTextDrawFont(playerid, playerammo[playerid], 1); PlayerTextDrawSetProportional(playerid, playerammo[playerid], 1); } timer OnUpdatePlayer[1000]() { foreach(Player,i) { new weaponid = GetPlayerWeapon(i); PlayerTextDrawSetPreviewModel(i, playerweapon[i], GetWeaponModel(weaponid)); } return 1; } stock GetWeaponModel(weaponid) { switch(weaponid) { case 1: return 331; case 2..8: return weaponid+331; case 9: return 341; case 10..15: return weaponid+311; case 16..18: return weaponid+326; case 22..29: return weaponid+324; case 30,31: return weaponid+325; case 32: return 372; case 33..45: return weaponid+324; case 46: return 371; } return 0; }