Add Player's name to car's name?
#10

Quote:
Originally Posted by Ken97
Посмотреть сообщение
pawn Код:
format(pCarName, sizeof(pCarName),"%s'%s", PlayerInfo[playerid][UserName], PlayerInfo[playerid][CarID]); //
This will output the car id not the vehicle's name.

Why not use the GetVehicleName function?


pawn Код:
stock GetVehicleName(vehicleid)
{
    new String[150];
    format(String,sizeof(String),"%s",VehicleNames[GetVehicleModel(vehicleid) - 400]);
    return String;
}


new VehicleNames[][] =
{
    "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", "Previon", "Coach", "Cabbie",
    "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral",
    "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "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", "Boxville", "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", "Hustler", "Intruder", "Primo",
    "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite",
    "Windsor", "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratium",
    "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", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
    "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car",
    "Police Car", "Police Car", "Police Ranger", "Picador", "S.W.A.T", "Alpha",
    "Phoenix", "Glendale", "Sadler", "Luggage", "Luggage", "Stairs", "Boxville",
    "Tiller", "Utility Trailer"
};




This is what I have in my gm, might help you.
pawn Код:
car= Dealership_AddVehicle(DealershipID, vModel, vPaint, vComponents, vX, vY, vZ, vR, C1, C2);
                    new string5[150];
                   
     format(string5,sizeof(string5),"%s's %s" , VehicleData[car][Owner],GetVehicleName(car));
      new Text3D:ownedby = Create3DTextLabel(string5,0x00FF00FF,0.0,0.0,0.0,300.0,0,0);
Im using the GetVehicleNameByModelId function to get the vehicle's name, and my previous code had a typho it should be...
Код:
{
	new hashpass[129], pCarName[64];
	format(pCarName, sizeof(pCarName),"%s'%s", PlayerInfo[playerid][UserName], PlayerInfo[playerid][CarName]);
	WP_Hash(hashpass, sizeof(hashpass), inputtext);
	if(!strcmp(hashpass, PlayerInfo[playerid][Password]))
	{
		SendClientMessage(playerid, 0x00FF00FF,"You have succesfully logged in.\nWelcome back to a Bum's Life!");
		pCarName = CreateVehicle(PlayerInfo[playerid][CarID], PlayerInfo[playerid][CarX], PlayerInfo[playerid][CarY], PlayerInfo[playerid][CarZ], PlayerInfo[playerid][CarA], PlayerInfo[playerid][CarCol1], PlayerInfo[playerid][CarCol2], 0);
		Finished = 1;
	}
	else
	{
		ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","{FF0000}You have entered an Incorrect password!\n{FFFFFF}Please enter your Correct password to login.","Login","Quit");
		return 1;
	}
	return 1;
}
return 1;
Still gives me the error though.

Oh and my Enum looks like this...

Код:
enum PlayerData
{
	UserName[MAX_PLAYER_NAME],
	Password[129],
	Float:PosX,
	Float:PosY,
	Float:PosZ,
	Float:PosA,
	Interior,
	VirtualWorld,
	Skin,
	Wallet,
	Bank,
	CarName[32],
	CarID,
	CarVW,
	CarI,
	Float:CarX,
	Float:CarY,
	Float:CarZ,
	Float:CarA,
	CarCol1,
	CarCol2
}
new PlayerInfo[MAX_PLAYERS][PlayerData];
My save function looks like this...
Код:
stock Save_Info(playerid)
{
	GetPlayerPos(playerid, PlayerInfo[playerid][PosX], PlayerInfo[playerid][PosY], PlayerInfo[playerid][PosZ]);
	GetPlayerFacingAngle(playerid, PlayerInfo[playerid][PosA]);

	new	INI:File = INI_Open(PPath(playerid));
	INI_SetTag(File,"Player_Data");
	INI_WriteFloat(File,"PosX", PlayerInfo[playerid][PosX]);
	INI_WriteFloat(File,"PosY", PlayerInfo[playerid][PosY]);
	INI_WriteFloat(File,"PosZ", PlayerInfo[playerid][PosZ]);
	INI_WriteFloat(File,"PosA", PlayerInfo[playerid][PosA]);
	INI_WriteInt(File,"VirtualWorld", GetPlayerVirtualWorld(playerid));
	INI_WriteInt(File,"Interior", GetPlayerInterior(playerid));
	INI_WriteInt(File,"Skin", GetPlayerSkin(playerid));
	INI_WriteInt(File,"Wallet", PlayerInfo[playerid][Wallet]);
	INI_WriteInt(File,"Bank", PlayerInfo[playerid][Bank]);
	INI_WriteString(File,"CarName", PlayerInfo[playerid][CarName]);
	INI_WriteInt(File,"CarID", PlayerInfo[playerid][CarID]);
	INI_WriteInt(File,"CarVW", PlayerInfo[playerid][CarVW]);
	INI_WriteInt(File,"CarI", PlayerInfo[playerid][CarI]);
	INI_WriteFloat(File,"CarX", PlayerInfo[playerid][CarX]);
	INI_WriteFloat(File,"CarY", PlayerInfo[playerid][CarY]);
	INI_WriteFloat(File,"CarZ", PlayerInfo[playerid][CarZ]);
	INI_WriteFloat(File,"CarA", PlayerInfo[playerid][CarA]);
	INI_WriteInt(File,"CarColor1", PlayerInfo[playerid][CarCol1]);
	INI_WriteInt(File,"CarColor2", PlayerInfo[playerid][CarCol2]);
	INI_Close(File);
}
Reply


Messages In This Thread
Add Player's name to car's name? - by Hyperfire - 12.02.2013, 09:53
Re: Add Player's name to car's name? - by Da_Noob - 12.02.2013, 10:45
Re: Add Player's name to car's name? - by Jstylezzz - 12.02.2013, 11:03
Re: Add Player's name to car's name? - by DrDoom151 - 12.02.2013, 11:07
Re: Add Player's name to car's name? - by Jstylezzz - 12.02.2013, 11:08
Re: Add Player's name to car's name? - by Hyperfire - 12.02.2013, 12:46
Re: Add Player's name to car's name? - by Neil. - 12.02.2013, 12:51
Re: Add Player's name to car's name? - by Hyperfire - 12.02.2013, 20:33
Re: Add Player's name to car's name? - by Neil. - 12.02.2013, 21:07
Re: Add Player's name to car's name? - by Hyperfire - 12.02.2013, 21:38

Forum Jump:


Users browsing this thread: 2 Guest(s)