Ehh - some help - 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: Ehh - some help (
/showthread.php?tid=195408)
Ehh - some help -
SparkZ_ - 02.12.2010
Heyo!
I've made this command:
Which teleports the player and his vehicle 1000 feet into the air.
pawn Код:
if(strcmp("/vdive",cmdtext,true) == 0)
{
new Float:X,Float:Y,Float:Z;
new getv = GetPlayerVehicleID(playerid);
GetPlayerPos(playerid,X,Y,Z);
SetPlayerPos(playerid,X,Y,Z+1000);
SetVehiclePos(getv,X,Y,Z+1000);
PutPlayerInVehicle(playerid,getv,0);
return 1;
}
Does anyone know how i can improve this, so you can select the height, example:
Thanks
Re: Ehh - some help -
Gh0sT_ - 02.12.2010
COMMAND:vdive( playerid, params[ ] )
{
new
Height
;
if( sscanf( params, "d", Height )) return SendClientMessage( playerid, YELLOW, "Usage: /vdive <Height>");
if( !IsPlayerInAnyVehicle( playerid )) return SendClientMessage( playerid, YELLOW, "You need to be in vehicle." );
new
vID = GetPlayerVehicleID( playerid ),
Float:X,
Float:Y,
Float:Z,
Float:A
;
GetVehiclePos( vID, X, Y, Z );
GetVehicleZAngle( vID, A );
SetVehiclePos( vID, X, Y, Z + Height );
SetVehicleZAngle( vID, A );
return true;
}
Re: Ehh - some help -
Scenario - 02.12.2010
I did this in like 2 minutes;
pawn Код:
command(vdive, playerid, params[])
{
if(sscanf(params, "d", value))
return SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /vdive [height]");
if(!IsPlayerInAnyVehicle(playerid))
return SendClientMessage(playerid, COLOR_RED, "ERROR: You aren't in a vehicle!");
new Float:Pos[3], value;
new vehid = GetPlayerVehicleID(playerid);
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]+value);
SetVehiclePos(vehid, Pos[0], Pos[1], Pos[2]+value);
PutPlayerInVehicle(playerid, vehid, 0);
return 1;
}
It uses ZCMD and SSCANF.
Re: Ehh - some help -
SparkZ_ - 02.12.2010
Quote:
Originally Posted by RealCop228
I did this in like 2 minutes;
pawn Код:
command(vdive, playerid, params[]) { if(sscanf(params, "d", value)) return SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /vdive [height]");
new Float:Pos[3], value; new vehid = GetPlayerVehicleID(playerid); GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]); SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]+value); SetVehiclePos(vehid, Pos[0], Pos[1], Pos[2]+value); PutPlayerInVehicle(playerid, vehid, 0); return 1; }
It uses ZCMD and SSCANF.
|
Ye, well i'm new to this language, Thanks both of you.
Re: Ehh - some help -
Scenario - 02.12.2010
I updated my code; it's up to you who's you use though. Good luck!