CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
iPLEOMAX - 26.06.2011
CreateVehicleForPlayer V2.1!
*This is my first include, I was a newbie in pawn back then.
You can use this include to add a new vehicle spawning function.
How it works:
#include <pvehicle>
CreateVehicleForPlayer(playerid,
vehiclename[],
color1,
color2,
Float:Health);
pawn Код:
CreateVehicleForPlayer(playerid, "NRG", -1,-1, 1000);
//This will create an NRG bike near the player and automatically put him in
//according to the player's virtual world, interior etc.
//Other examples:
CreateVehicleForPlayer(playerid, "520", -1,-1, 1000);
//As you can see here we put an integer but in the format of a string
//But this will tell the code to spawn a vehicle with id 520, which is a Hydra.
CreateVehicleForPlayer(playerid, "900", -1, -1, 1000);
//It will not create a vehicle with model id 900 cause it doesn't exist.
//Instead it will spawn an FCR-900 for you. ;)
You can also use it this way:
pawn Код:
new myvehicle;
myvehicle = CreateVehicleForPlayer(playerid, "NRG", -1, -1, 1000.0);
// so, you can attach stuff / tele it.. or whateva.
So, we can use names & ids both and easily create vehicles for
a certain player without a lot of other codes.
To delete the PLAYER's Vehicle:
pawn Код:
DeletePlayerVehicle(playerid); //This will ONLY DELETE the vehicle spawned by THIS include!
//And If it is server vehicle, it will respawn it.
Lets see this in a working command (ZCMD & sscanf):
pawn Код:
CMD:car(playerid, params[])
{
new vname[20];
if(!sscanf(params,"s[20]",vname))
{
if(!IsPlayerInAnyVehicle(playerid))
{
CreateVehicleForPlayer(playerid, vname, -1, -1, 1000.0);
} else SendClientMessage(playerid, COLOR_RED, "You already have a vehicle.");
} else SendClientMessage(playerid, COLOR_RED, "Usage: /car [vehicle name]");
return true;
}
If I use /car turi, it will create a turismo for me.
/car 400, it will create landstalker.
/car bullet, it will create bullet.
SIMPLE!
Now, the download?
Here:
Pastebin - Version 2.1
MediaFire - Version 2.1
Place "pvehicle.inc" in pawno/include/ folder.. then add #include <pvehicle> to your script.
If you like my work, Help me to help a community: AlertPay E-Mail:
morshidul@hotmail.com
AlertPay Link
-Thanks to Toribio for his include, because i learnt few things from there.
--
Re: CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
FireCat - 26.06.2011
Nice and easy to do.
Re: CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
Markx - 26.06.2011
Will the others see the car?
Re: CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
RyDeR` - 26.06.2011
What about deleting the vehicle back?
Re: CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
iPLEOMAX - 26.06.2011
Quote:
Originally Posted by Markx
Will the others see the car?
|
Yes Ofcourse.
Quote:
Originally Posted by RyDeR`
What about deleting the vehicle back?
|
Oki, I will add this in next version.
Re : CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
ludesert - 29.06.2011
Cool
Re: CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
juraska - 29.06.2011
Very simple and cool
Re: CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
sasuga - 29.06.2011
very usefull thx nice release ^^
Re: CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
Genious - 29.06.2011
Cool thanks
Re: CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
yuri29971102 - 01.07.2011
how can i get vehicleid?
Re: CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
marwan - 01.07.2011
from samp wiki use ****** write samp vehicle ids
Re: CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
iPLEOMAX - 01.07.2011
Quote:
Originally Posted by yuri29971102
how can i get vehicleid?
|
All Vehicle ID List
Re: CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
Horrible - 15.07.2011
NICE!
many pople need this INC!
Re: CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
Horrible - 28.07.2011
not works
pawn Код:
CMD:car(playerid, params[])
{
new vname[20];
if(!sscanf(params,"s[20]",vname))
{
if(!IsPlayerInAnyVehicle(playerid))
{
CreateVehicleForPlayer(playerid, vname, -1, -1);
} else SendClientMessage(playerid, COLOR_RED, "You already have a vehicle.");
} else SendClientMessage(playerid, COLOR_RED, "Usage: /car [vehicle name]");
return true;
}
Код:
TA(ary)1ab\gamemodes\tombodos.pwn(2095) : warning 202: number of arguments does not match definition
it just a warning but when itry to start my server it say run time error invalid file or funtion
please help.....
AW: CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
Tigerkiller - 29.07.2011
he forgot a parameter
so it wont work
pawn Код:
CMD:car(playerid, params[])
{
new vname[20];
if(!sscanf(params,"s[20]",vname))
{
if(!IsPlayerInAnyVehicle(playerid))
{
CreateVehicleForPlayer(playerid, vname, -1, -1,1000.0); // he forgot VehicleHealth
} else SendClientMessage(playerid, COLOR_RED, "You already have a vehicle.");
} else SendClientMessage(playerid, COLOR_RED, "Usage: /car [vehicle name]");
return true;
}
Re: CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
Zh3r0 - 29.07.2011
Quote:
Originally Posted by iPLEOMAX
|
That's not Vehicle ID, but vehicle models.
Re: CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
iPLEOMAX - 29.07.2011
Quote:
Originally Posted by Zh3r0
That's not Vehicle ID, but vehicle models.
|
My Bad. Well, I added it now.
Update:
pawn Код:
new myvehicle;
myvehicle = CreateVehicleForPlayer(playerid, "NRG", -1, -1, 1000.0);
//And now we can attach, do stuff to myvehicle.
AW: CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
Pablo Borsellino - 29.07.2011
Why add the Syntax playerid for the Function, but dont have usefull If-query like: IsValidPlayerVehicle or IsPlayerInHisVehicle?
And wtf:
Quote:
//Instead it will spawn an FCR-900 for you. 
|
Why not only return false or something gonna like that.. Scripters Mistake = FCR 900 - mhh I think not good.
But well, nice. (Add Pastebin please too)
Re: AW: CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
iPLEOMAX - 29.07.2011
Quote:
Originally Posted by Pablo Borsellino
Why add the Syntax playerid for the Function, but dont have usefull If-query like: IsValidPlayerVehicle or IsPlayerInHisVehicle? And wtf:
Why not only return false or something gonna like that.. Scripters Mistake = FCR 900 - mhh I think not good.
But well, nice. (Add Pastebin please too)
|
Added a pastebin version.
No worries, model id 900 isn't there, So i guess no scripter will use that unless he wants an fcr.

+ I appreciate your suggestions, will add in later versions.
Re: CreateVehicleForPlayer - Use Names to create vehicles, Easily. -
Killer786 - 12.10.2011
wOWW! thaNKS!