SA-MP Forums Archive
Player TextDraw bug - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Player TextDraw bug (/showthread.php?tid=620806)



Player TextDraw bug - NeXoR - 03.11.2016

Hey guys, here is my Player TextDraw for VehicleNames
This is under OnPlayerStateChange
PHP код:
    // Anti Vehicle Entrance Hacking && Vehicle Names
    
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
        
PlayerTextDrawSetString(playeridVehName[playerid], RVN(GetPlayerVehicleID(playerid)));
        
PlayerTextDrawShow(playeridVehName[playerid]);
        
SetTimerEx("HideVehName"20000"i"playerid);
        if(
IsHitmanVehicle(GetPlayerVehicleID(playerid)) && !PlayerInfo[playerid][pHitman] && !Iter_Contains(Adminsplayerid))
            return 
AddBan(playeridRPN(playerid), "Anti Cheat""Vehicle Hacking"RPIP(playerid));
    }
    if(
oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGERPlayerTextDrawHide(playeridVehName[playerid]); 
The textdraw simply doesn't show
Anyone ?


Re: Player TextDraw bug - Jelly23 - 03.11.2016

Are u sure that the textdraw is being created? Sometimes i declare global textdraws and forget to create them at OnGameModeInit, so they don't show up. Maybe you forgot to put yours at OnPlayerConnect? Also, provide RVN function (which is used to return the vehicle name).


Re: Player TextDraw bug - NeXoR - 03.11.2016

Quote:
Originally Posted by Jelly23
Посмотреть сообщение
Are u sure that the textdraw is being created? Sometimes i declare global textdraws and forget to create them at OnGameModeInit, so they don't show up. Maybe you forgot to put yours at OnPlayerConnect? Also, provide RVN function (which is used to return the vehicle name).
Here is OnPlayerConnect
PHP код:
//
    
VehName[playerid] = CreatePlayerTextDraw(playerid510.999938332.266845".");
    
PlayerTextDrawLetterSize(playeridVehName[playerid], 0.6903333.524740);
    
PlayerTextDrawAlignment(playeridVehName[playerid], 2);
    
PlayerTextDrawColor(playeridVehName[playerid], -5963521);
    
PlayerTextDrawSetShadow(playeridVehName[playerid], 0);
    
PlayerTextDrawSetOutline(playeridVehName[playerid], 1);
    
PlayerTextDrawBackgroundColor(playeridVehName[playerid], 51);
    
PlayerTextDrawFont(playeridVehName[playerid], 0);
    
PlayerTextDrawSetProportional(playeridVehName[playerid], 1); 
Here is RVN
PHP код:
RVN(carid)
{
    new 
name[32];
    
format(namesizeof(name), "%s"VehicleNames[carid-400]);
    return 
name;

Here is VehicleName
PHP код:
new VehicleNames[212][] =
{
    
"Landstalker""Bravura""Buffalo""Linerunner""Perrenial""Sentinel""Dumper""Firetruck""Trashmaster""Stretch""Manana",
    
"Infernus""Voodoo""Pony""Mule""Cheetah""Ambulance""Leviathan""Moonbeam""Esperanto""Taxi""Washington""Bobcat",
    
"Whoopee""BF Injection""Hunter""Premier""Enforcer""Securicar""Banshee""Predator""Bus""Rhino""Barracks""Hotknife",
    
"Trailer 1""Previon""Coach""Cabbie""Stallion""Rumpo""RC Bandit""Romero""Packer""Monster""Admiral""Squalo",
    
"Seasparrow""Pizzaboy""Tram""Trailer 2""Turismo""Speeder""Reefer""Tropic""Flatbed""Yankee""Caddy""Solair",
    
"Berkley's RC Van""Skimmer""PCJ-600""Faggio""Freeway""RC Baron""RC Raider""Glendale""Oceanic""Sanchez""Sparrow",
    
"Patriot""Quad""Coastguard""Dinghy""Hermes""Sabre""Rustler""ZR-350""Walton""Regina""Comet""BMX""Burrito",
    
"Camper""Marquis""Baggage""Dozer""Maverick""News Chopper""Rancher""FBI Rancher""Virgo""Greenwood""Jetmax""Hotring",
    
"Sandking""Blista Compact""Police Maverick""Boxvillde""Benson""Mesa""RC Goblin""Hotring Racer A""Hotring Racer B",
    
"Bloodring Banger""Rancher""Super GT""Elegant""Journey""Bike""Mountain Bike""Beagle""Cropduster","Stunt",  "Tanker",
    
"Roadtrain""Nebula""Majestic""Buccaneer""Shamal""Hydra""FCR-900""NRG-500""HPV1000""Cement Truck""Tow Truck""Fortune",
    
"Cadrona""FBI Truck""Willard""Forklift""Tractor""Combine""Feltzer""Remington""Slamvan""Blade""Freight""Streak",
    
"Vortex""Vincent""Bullet""Clover""Sadler""Firetruck LA""Hustler""Intruder""Primo""Cargobob""Tampa""Sunrise""Merit",
    
"Utility""Nevada""Yosemite""Windsor""Monster A""Monster B""Uranus""Jester""Sultan""Stratum""Elegy""Raindance",
    
"RC Tiger""Flash""Tahoma""Savanna""Bandito""Freight Flat""Streak Carriage""Kart""Mower""Dune""Sweeper""Broadway",
    
"Tornado""AT-400""DFT-30""Huntley""Stafford""BF-400""News Van""Tug""Trailer 3""Emperor""Wayfarer""Euros""Hotdog",
    
"Club""Freight Carriage""Trailer 4""Andromada""Dodo""RC Cam""Launch""Police Car (LSPD)""Police Car (SFPD)",
    
"Police Car (LVPD)""Police Rancher""Picador""S.W.A.T""Alpha""Phoenix""Glendale""Sadler""Luggage Trailer A",
    
"Luggage Trailer B""Stairs""Boxville""Tiller""Utility Trailer"
}; 



Re: Player TextDraw bug - Jelly23 - 03.11.2016

in RVN you should provide the model id, not the vehicle id.

change:

PHP код:
RVN(GetPlayerVehicleID(playerid)) 
to:

PHP код:
RVN(GetVehicleModel(GetPlayerVehicleID(playerid))) 



Re: Player TextDraw bug - NeXoR - 03.11.2016

Quote:
Originally Posted by Jelly23
Посмотреть сообщение
in RVN you should provide the model id, not the vehicle id.

change:

PHP код:
RVN(GetPlayerVehicleID(playerid)) 
to:

PHP код:
RVN(GetVehicleModel(GetPlayerVehicleID(playerid))) 
Oh yeah, stupid me, thanks.