SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 25/12/2013, 11:22 AM   #1
Areax
Huge Clucker
 
Areax's Avatar
 
Join Date: Mar 2013
Location: Slovenia
Posts: 464
Reputation: 14
Default [HELP]: Gun textdraws

Hello SA:MP !

I have a question about textdraws and that is, How can I add gun images as a textdraw ingame ?

Thanks!
Areax is offline   Reply With Quote
Old 25/12/2013, 11:29 AM   #2
Aliassassin123456
Banned
 
Join Date: Apr 2013
Location: 0x7f000001
Posts: 233
Reputation: 67
Default Re: [HELP]: Gun textdraws

use TextDrawSetPreviewModel
Get your own weapon object id and use that function
Weapon object model ids are here: http://wiki.sa-mp.com/wiki/Weapons
Aliassassin123456 is offline   Reply With Quote
Old 25/12/2013, 12:12 PM   #3
Patrick
Guest
 
Posts: n/a
Default Re: [HELP]: Gun textdraws

You need this function to be able to create a textdraw made out of Weapon Image, as Aliassassin123456 said you need to create a textdraw using TextDrawSetPreviewModel

All in All

pawn Code:
#include <a_samp>

new Text:textdraw;

public OnGameModeInit()
{
    textdraw = TextDrawCreate(320.0, 240.0, "_");
    TextDrawFont(textdraw, TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawUseBox(textdraw, 1);
    TextDrawBoxColor(textdraw, 0x000000FF);
    TextDrawTextSize(textdraw, 40.0, 40.0);
    return true;
}

public OnPlayerUpdate(playerid)
{
    return TextDrawSetPreviewModel(textdraw, GetObjectModel(playerid));
}

stock GetObjectModel(playerid)
{
    new
        _ObjectModel = 0;
    switch( GetPlayerWeapon( playerid ) )
    {
        case 1: _ObjectModel = 331;
        case 2: _ObjectModel = 333;
        case 3: _ObjectModel = 334;
        case 4: _ObjectModel = 335;
        case 5: _ObjectModel = 336;
        case 6: _ObjectModel = 337;
        case 7: _ObjectModel = 338;
        case 8: _ObjectModel = 339;
        case 9: _ObjectModel = 341;
        case 10: _ObjectModel = 321;
        case 11: _ObjectModel = 322;
        case 12: _ObjectModel = 323;
        case 13: _ObjectModel = 324;
        case 14: _ObjectModel = 325;
        case 15: _ObjectModel = 326;
        case 16: _ObjectModel = 342;
        case 17: _ObjectModel = 343;
        case 18: _ObjectModel = 344;
        case 22: _ObjectModel = 346;
        case 23: _ObjectModel = 347;
        case 24: _ObjectModel = 348;
        case 25: _ObjectModel = 349;
        case 26: _ObjectModel = 350;
        case 27: _ObjectModel = 351;
        case 28: _ObjectModel = 352;
        case 29: _ObjectModel = 353;
        case 30: _ObjectModel = 354;
        case 31: _ObjectModel = 356;
        case 32: _ObjectModel = 372;
        case 33: _ObjectModel = 357;
        case 34: _ObjectModel = 358;
        case 35: _ObjectModel = 359;
        case 36: _ObjectModel = 360;
        case 37: _ObjectModel = 361;
        case 38: _ObjectModel = 362;
        case 39: _ObjectModel = 363;
        case 40: _ObjectModel = 364;
        case 41: _ObjectModel = 365;
        case 42: _ObjectModel = 366;
        case 43: _ObjectModel = 367;
        case 44: _ObjectModel = 368;
        case 45: _ObjectModel = 369;
        case 46: _ObjectModel = 371;
    }
    return _ObjectModel;
}
  Reply With Quote
Old 25/12/2013, 12:14 PM   #4
Verth
Big Clucker
 
Join Date: Dec 2012
Posts: 66
Reputation: 89
Default Re: [HELP]: Gun textdraws

mselection is also an option.
__________________
-
Verth is offline   Reply With Quote
Old 25/12/2013, 01:32 PM   #5
Areax
Huge Clucker
 
Areax's Avatar
 
Join Date: Mar 2013
Location: Slovenia
Posts: 464
Reputation: 14
Default Re: [HELP]: Gun textdraws

Thanks
Areax is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Help] Mix with TextDraws Pajser Scripting Help 6 02/06/2013 06:31 PM
Global TextDraws on top of Player TextDraws [resolved] Joe Staff Scripting Help 0 17/05/2013 05:35 AM
[BUG] Selecting textdraws lighting up multiple textdraws Hiddos Scripting Help 3 24/03/2012 02:44 PM
Help with TextDraws iSplasH General 0 17/03/2012 12:49 PM
[TEXTDRAWS] Textdraws mixed up KnooL Help Archive 22 23/06/2010 02:52 PM


All times are GMT. The time now is 12:25 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.