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)
+--- Thread: help (
/showthread.php?tid=315775)
help -
Fires - 04.02.2012
how do I convert this command to zcmd and sscanf?? help me pls з_з
pawn Код:
if(strcmp(cmd, "/v", true, 10) == 0)
{
new String[200];
new tmp[256];
new Float:x, Float:y, Float:z;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, l_red, "Non hai messo il nome del veicolo");
new vehicle = GetVehicleModelIDFromName(tmp);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, l_red, "Veicolo non trovato");
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
format(String, sizeof(String), "Hai Spawnato: %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid, l_green, String);
return 1;
}
Thanks
Re: help -
Konstantinos - 04.02.2012
Untested.
pawn Код:
CMD:v( playerid, params[ ] )
{
new
VehName[ 64 ], String[ 128 ], Float:x, Float:y, Float:z, Float:a, PlayersVehicle, vehicle = GetVehicleModelIDFromName( VehName );
if( sscanf( params, "s[64]", VehName ) ) return SendClientMessage( playerid, -1, "Usage: /v <Part Of Vehicle Name>" );
if( vehicle < 400 || vehicle > 611 ) return SendClientMessage( playerid, -1, "Invalid Vehicle Name!" );
GetPlayerFacingAngle( playerid, a );
GetPlayerPos( playerid, x, y, z );
if( IsPlayerInAnyVehicle( playerid ) == 1 ) GetXYInFrontOfPlayer( playerid, x, y, 8 );
else GetXYInFrontOfPlayer(playerid, x, y, 5);
PlayersVehicle = CreateVehicle( vehicle, x, y, z, a + 90, -1, -1, -1 );
LinkVehicleToInterior( PlayersVehicle, GetPlayerInterior( playerid ) );
format( String, sizeof( String ), "Hai Spawnato: %s", aVehicleNames[ vehicle - 400 ] );
SendClientMessage( playerid, -1, String );
return 1;
}