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=201006)
Car Spawn -
Rokzlive - 20.12.2010
How do i make a command that spawns a certain car model next to you. Like i say /buffalo and an buffalo spawns next to me?
Re: Car Spawn -
Basicz - 20.12.2010
pawn Код:
COMMAND:mower ( playerid, params [ ] )
{
new
Float: X,
Float: Y,
Float: Z,
Float: A;
GetPlayerPos ( playerid, X, Y, Z );
GetPlayerFacingAngle ( playerid, A );
CreateVehicle ( 572, X + 4.0, Y, Z, A, -1, -1, -1 )
return 1;
}
You can always use a stock too.
EDIT :
Here's an example of a stock.
pawn Код:
stock CreateVehForPlayer(playerid, vehid)
{
// Copy from the example above
new
Float: X,
Float: Y,
Float: Z,
Float: A;
GetPlayerPos ( playerid, X, Y, Z );
GetPlayerFacingAngle ( playerid, A );
//
CreateVehicle ( vehid, X + 4.0, Y, Z, A, -1, -1, -1 ) ;
return 1;
}
e.G : CreateVehForPlayer(playerid, 411);
Re: Car Spawn -
admantis - 20.12.2010
Quote:
Originally Posted by Basicz
pawn Код:
COMMAND:mower ( playerid, params [ ] ) { new Float: X, Float: Y, Float: Z, Float: A; GetPlayerPos ( playerid, X, Y, Z ); GetPlayerFacingAngle ( playerid, A );
CreateVehicle ( 572, X + 4.0, Y, Z, A, -1, -1, -1 ) return 1; }
You can always use a stock too.
|
and spam upto 2000 lines with every every car?
Re: Car Spawn -
Basicz - 20.12.2010
Quote:
Originally Posted by admantis
and spam upto 2000 lines with every every car?
|
Uhmm.. What do you mean? I am a little bit confused...
Re: Car Spawn -
admantis - 20.12.2010
Quote:
Originally Posted by Basicz
Uhmm.. What do you mean? I am a little bit confused...
|
i mean he has to do /mower but he has to make more commands for every single car so it's better using strtok or sscanf
Re: Car Spawn -
Basicz - 20.12.2010
Oh yeah, that will be bad.
This is Rokzlive's message : "Like i say /buffalo and an buffalo spawns next to me?"
But like what admantis said, it's better to do /spawncar [vehid] command.
Re: Car Spawn -
Rokzlive - 20.12.2010
I did this:
pawn Код:
if(!strcmp(cmdtext, "/mower", true))
{
new
Float: X,
Float: Y,
Float: Z,
Float: A,
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
CreateVehicle(572, X +4.0, Y, Z, -1, -1, -1);
return 1;
}
And got these errors.
Код:
C:\Users\ET183105\Desktop\New folder\ServerFinal\gamemodes\1.pwn(835) : warning 219: local variable "GetPlayerPos" shadows a variable at a preceding level
C:\Users\ET183105\Desktop\New folder\ServerFinal\gamemodes\1.pwn(835) : error 001: expected token: ";", but found "("
C:\Users\ET183105\Desktop\New folder\ServerFinal\gamemodes\1.pwn(835) : warning 215: expression has no effect
C:\Users\ET183105\Desktop\New folder\ServerFinal\gamemodes\1.pwn(837) : warning 202: number of arguments does not match definition
C:\Users\ET183105\Desktop\New folder\ServerFinal\gamemodes\1.pwn(835) : warning 203: symbol is never used: "GetPlayerPos"
Re: Car Spawn -
Basicz - 20.12.2010
Change
Float: A,
TO
Float: A;
EDIT:
And the CreateVehicle
TO
CreateVehicle ( 572, X + 4.0, Y, Z, A, -1, -1, -1 );
Re: Car Spawn -
Rokzlive - 20.12.2010
I want to make individual commands, i just like it that way instead of remembering ids, so what i do?
Re: Car Spawn -
Rokzlive - 20.12.2010
Nevermind that fixed it, thankyou.