engine CMD
#1

can someone tell me how to change this message "SendClientMessage(playerid, colorYellow, "Vehicle engine started");" to (("Player name" starts the engine of "car name")) for example "Peter_Mikoliv starts the engine of Infernus"
Reply
#2

download this include https://sampforum.blast.hk/showthread.php?tid=566775 and then type #include GVN after #include a_samp
and here is your message
Код:
SendClientMessage(playerid, colorYellow, "%s  starts the engine of %s")GetName(playerid),GetVehicleName(modelid));
Reply
#3

Quote:
Originally Posted by FuNkYTheGreat
Посмотреть сообщение
download this include https://sampforum.blast.hk/showthread.php?tid=566775 and then type #include GVN after #include a_samp
and here is your message
Код:
SendClientMessage(playerid, colorYellow, "%s  starts the engine of %s")GetName(playerid),GetVehicleName(modelid));
No need for an include, a simple array is good enough. But sure if he likes to add more includes then he may.

Код:
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"
};

stock GetVehicleName(vehicleid)
{
	format(String,sizeof(String),"%s",VehicleNames[GetVehicleModel(vehicleid) - 400]);
	return String;
}


new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s starts the engine of %s", name, GetVehicleName(GetPlayerVehicleID(playerid)));
SendClientMessage(playerid, colorYellow, string);
Reply
#4

Guys when i try to compile the gamemode i get these errors:-
PHP код:
D:\myownscript\gamemodes\fgrp.pwn(275) : error 001expected token";"but found "-identifier-"
D:\myownscript\gamemodes\fgrp.pwn(275) : error 017undefined symbol "GetName"
D:\myownscript\gamemodes\fgrp.pwn(275) : error 029invalid expressionassumed zero
D
:\myownscript\gamemodes\fgrp.pwn(275) : fatal error 107too many error messages on one line

Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase


4 Errors

the line is this:-
PHP код:
        SendClientMessage(playeridCOLOR_PURPLE"%s  attempts to start the engine of %s")GetName(playerid),GetVehicleName(modelid)); 
kindly someone tell me how to use it.
Reply
#5

https://sampwiki.blast.hk/wiki/GetPlayerName
Reply
#6

There is something that most people tend to forget and that is if a vehicle that does not exist given, it will basically try to get the name from index -400 which will cause run time error 4. To simple avoid it:
pawn Код:
GetVehicleName(vehicleid)
{
    new v_name[17], modelid = GetVehicleModel(vehicleid);
    if (modelid) strcat(v_name, VehicleNames[modelid - 400]);
    return v_name;
}
---

Your code:
Код:
"%s  attempts to start the engine of %s")GetName(playerid)
There should be a comma instead of parentheses before GetName function.
Reply
#7

Quote:
Originally Posted by F1N4L
Посмотреть сообщение
can u plz gimme a fixed line?
Reply
#8

Quote:
Originally Posted by xXtremeXx
Посмотреть сообщение
can u plz gimme a fixed line?
Example Usage:

Quote:

public OnPlayerConnect(playerid)
{
// Get the name of the player that connected and display a join message to other players

new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));

format(string, sizeof(string), "%s has joined the server.", name);
SendClientMessageToAll(0xC4C4C4FF, string);

return 1;
}

Reply
#9

Код:
stock GetName(playerid)
{
    new name[24];
    GetPlayerName(playerid, name, 24);
    return name;
}
Reply
#10

Quote:
Originally Posted by AlonzoTorres
Посмотреть сообщение
Example Usage:
Thanks it works. +rep for you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)