SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 31/05/2017, 06:01 PM   #1
tekass
Little Clucker
 
Join Date: May 2017
Posts: 21
Reputation: 0
Post How to use "DestroyVehicle" whitout player in vehicle?

Hi all, i need help with the Callback "DestoyVehicle" Because I have succeded to make it work but only with GetPlayerVehicleID but I need to use it without player in the vehicle for my crusher system.

Here is the method I use:


Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext,"/fb", true))
     	{
      	new Float:x, Float:y, Float:z;
	new idcar;
	idcar = GetVehiclePos(idcar, x, y, z);
	DestroyVehicle(idcar);
     	GameTextForPlayer(playerid, "Vehicule broyer!", 3500, 1);
        }
}
Tanks for you help.
tekass is offline   Reply With Quote
Old 31/05/2017, 06:08 PM   #2
JasonRiggs
Gangsta
 
Join Date: Jul 2016
Location: My bedroom.
Posts: 836
Reputation: 52
Default Re: How to use "DestroyVehicle" whitout player in vehicle?

Make it for example /fb <carid> add after the opened bracket if(strcmp, "u", carid) or smth, show me the create car cmd to re send u the code with fix
__________________
JasonRiggs is offline   Reply With Quote
Old 31/05/2017, 06:16 PM   #3
skuller12
Big Clucker
 
Join Date: Feb 2015
Location: Galati, Romania
Posts: 101
Reputation: 0
Default Re: How to use "DestroyVehicle" whitout player in vehicle?

try this code

Code:
new idcar = GetPlayerVehicleID(playerid);
	DestroyVehicle(idcar);
     	GameTextForPlayer(playerid, "Vehicule broyer!", 3500, 1);
skuller12 is offline   Reply With Quote
Old 31/05/2017, 06:17 PM   #4
JasonRiggs
Gangsta
 
Join Date: Jul 2016
Location: My bedroom.
Posts: 836
Reputation: 52
Default Re: How to use "DestroyVehicle" whitout player in vehicle?

Quote:
Originally Posted by skuller12 View Post
try this code

Code:
new idcar = GetPlayerVehicleID(playerid);
	DestroyVehicle(idcar);
     	GameTextForPlayer(playerid, "Vehicule broyer!", 3500, 1);
Maybe you didnt understand him, he wants to destroy a car while player is NOT inside it.
__________________
JasonRiggs is offline   Reply With Quote
Old 31/05/2017, 06:20 PM   #5
skuller12
Big Clucker
 
Join Date: Feb 2015
Location: Galati, Romania
Posts: 101
Reputation: 0
Default Re: How to use "DestroyVehicle" whitout player in vehicle?

Top:

native IsValidVehicle(vehicleid);

After in ZCMD:

Code:
CMD:fb(playerid, params[])
{
new v;
if(sscanf(params, "i", v)) return SendClientMessage(playerid, -1, "/fb <car id>");
if(!IsValidVehicle(v)) return 1;
DestroyVehicle(v);
 return 1;
}
skuller12 is offline   Reply With Quote
Old 31/05/2017, 06:23 PM   #6
JasonRiggs
Gangsta
 
Join Date: Jul 2016
Location: My bedroom.
Posts: 836
Reputation: 52
Default Re: How to use "DestroyVehicle" whitout player in vehicle?

Yeah that's the right one.
__________________
JasonRiggs is offline   Reply With Quote
Old 31/05/2017, 06:25 PM   #7
JasonRiggs
Gangsta
 
Join Date: Jul 2016
Location: My bedroom.
Posts: 836
Reputation: 52
Default Re: How to use "DestroyVehicle" whitout player in vehicle?

That's the right one but he needs it like that
Code:
if(!strcmp(cmdtext,"/fb", true))
{
new v;
if(sscanf(params, "i", v)) return SendClientMessage(playerid, -1, "/fb <car id>");
if(!IsValidVehicle(v)) return 1;
DestroyVehicle(v);
 return 1;
}
as he isnt using ZCMD
__________________
JasonRiggs is offline   Reply With Quote
Old 31/05/2017, 07:46 PM   #8
tekass
Little Clucker
 
Join Date: May 2017
Posts: 21
Reputation: 0
Default Re: How to use "DestroyVehicle" whitout player in vehicle?

Thanks for your help, but i have again error, how i defined "sscanf" please? Is just with "new sscanf;" ?

Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext,"/fb", true))
{
new v;
if(sscanf(params, "i", v)) return SendClientMessage(playerid, -1, "/fb <car id>");
if(!IsValidVehicle(v)) return 1;
DestroyVehicle(v);
return 1;
}
Code:
C:\Users\KEVIN\Desktop\My-RP-Life\filterscripts\CasseLegacy.pwn(387) : error 012: invalid function call, not a valid address
C:\Users\KEVIN\Desktop\My-RP-Life\filterscripts\CasseLegacy.pwn(387) : error 017: undefined symbol "params"
C:\Users\KEVIN\Desktop\My-RP-Life\filterscripts\CasseLegacy.pwn(387) : error 029: invalid expression, assumed zero
C:\Users\KEVIN\Desktop\My-RP-Life\filterscripts\CasseLegacy.pwn(387) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
PS: I need add that?

Code:
#include <sscanf>
tekass is offline   Reply With Quote
Old 31/05/2017, 08:17 PM   #9
tekass
Little Clucker
 
Join Date: May 2017
Posts: 21
Reputation: 0
Default Re: How to use "DestroyVehicle" whitout player in vehicle?

I try with that:

Code:
forward sscanf(const data[], const format[], {Float,_}:...);
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(!strcmp(cmdtext,"/fb", true))
	{
	new v;
	if(sscanf(params, "i", v)) return SendClientMessage(playerid, -1, "/fb <car id>");
	if(!IsValidVehicle(v)) return 1;
	DestroyVehicle(v);
	return 1;
	}
but error is:

Code:
C:\Users\KEVIN\Desktop\My-RP-Life\filterscripts\CasseLegacy.pwn(386) : error 004: function "sscanf" is not implemented
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Which is the valid function for sscanf please?
tekass is offline   Reply With Quote
Old 31/05/2017, 08:38 PM   #10
Whatname
Big Clucker
 
Join Date: Aug 2016
Posts: 177
Reputation: 12
Default Re: How to use "DestroyVehicle" whitout player in vehicle?

Change forward sscanf to other name
Whatname is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with "FADMIN" | How can i measure the Axis if i want to attach a object to a vehicle or player? ZayanImran Server Support 2 24/01/2013 07:38 PM
Does "DestroyVehicle" call public OnVehicleDeath? pasha97 Scripting Help 1 16/06/2012 03:20 PM
[Include] "OnPlayerLookAtVehicle" - Detect if a player is looking at some vehicle. iPLEOMAX Includes 46 28/01/2012 06:09 PM
"Slight homing", make a missile "Slightly!" home a vehicle. Donya Help Archive 4 11/06/2011 09:20 PM
Is player talks, use OnePlayAnim(playerid,"PED","IDLE_CHAT",4.0,0,0,0,0,0); Ihsan_Cingisiz Help Archive 5 30/05/2010 03:26 PM


All times are GMT. The time now is 08:48 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.