Car Spawn - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Car Spawn (
/showthread.php?tid=173059)
Car Spawn -
fie - 01.09.2010
Hey guys. Is it possible that when they spawn they get a car?
like
onplayerspawn
then some sort of command to give the person a car?
i hope there is, this would make me really happy.
Thanks
Re: Car Spawn -
[HiC]TheKiller - 01.09.2010
Do you want it to make a car or get a random unused car?
Re: Car Spawn -
fie - 01.09.2010
Quote:
Originally Posted by [HiC]TheKiller
Do you want it to make a car or get a random unused car?
|
I want it so it will spawn a brand new car for the person.
Re: Car Spawn -
iggy1 - 01.09.2010
pawn Код:
new Scar[MAX_PLAYERS];//at top with other variables
public OnPlayerSpawn(playerid)
{
new Float:x,Float:y,Float:z,Float:ang;
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,ang);
Scar[playerid] = CreateVehicle(522,x,y,z,ang,-1,-1,-1);//nrg
PutPlayerInVehicle(playerid,Scar[playerid],0)
return 1;
}
EDIT: Be carefull if you have interior spawns. If you have interior spawns add a check.
Re: Car Spawn -
LarzI - 01.09.2010
pawn Код:
public OnPlayerSpawn(playerid)
{
new
Float:x,
Float:y,
Float:z;
GetPlayerPos( playerid, x, y, z );
GetXYInfrontOfPlayer( playerid, x, y, 3.0 );
CreateVehicle( MODEL_HERE, x, y, z+0.5, -1, -1, -1 );
return true;
}
pawn Код:
GetXYInfrontOfPlayer(playerid,&Float:x,&Float:y,Float:Distance)
{
new Float:r;
if(IsPlayerInAnyVehicle(playerid)==0)GetPlayerFacingAngle(playerid,r);
else GetVehicleZAngle(GetPlayerVehicleID(playerid),r);
x += (Distance * floatsin(-r, degrees));
y += (Distance * floatcos(-r, degrees));
return 1;
}