SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 31/05/2017, 08:59 PM   #11
tekass
Little Clucker
 
Join Date: May 2017
Posts: 21
Reputation: 0
Default Re: How to use "DestroyVehicle" whitout player in vehicle?

That is to say? I need to change the location of the sscanf2.inc file?
tekass is offline   Reply With Quote
Old 31/05/2017, 09:11 PM   #12
Whatname
Big Clucker
 
Join Date: Aug 2016
Posts: 177
Reputation: 12
Default Re: How to use "DestroyVehicle" whitout player in vehicle?

No change this :

PHP Code:

forward sscanf
(const data[], const format[], {Float,_}:...); 
To this

PHP Code:

forward s_sscanf
(const data[], const format[], {Float,_}:...); //or any other name except existing function 
Whatname is offline   Reply With Quote
Old 31/05/2017, 09:13 PM   #13
tekass
Little Clucker
 
Join Date: May 2017
Posts: 21
Reputation: 0
Default Re: How to use "DestroyVehicle" whitout player in vehicle?

Ok i try thanks you
tekass is offline   Reply With Quote
Old 31/05/2017, 09:33 PM   #14
tekass
Little Clucker
 
Join Date: May 2017
Posts: 21
Reputation: 0
Default Re: How to use "DestroyVehicle" whitout player in vehicle?

No it's always the same :/

thanks anyway.
tekass is offline   Reply With Quote
Old 31/05/2017, 09:55 PM   #15
Nero_3D
High-roller
 
Nero_3D's Avatar
 
Join Date: Jun 2007
Location: Germany
Posts: 2,849
Reputation: 675
Default Re: How to use "DestroyVehicle" whitout player in vehicle?

Without using strtok, sscanf or any other dependency
PHP Code:
//OnPlayerCommandText
    
if(strcmp(cmdtext,"/fb"true3) == && cmdtext[3] <= ' ') {
        if(
cmdtext[3] == EOS || cmdtext[4] == EOS) {
            return 
SendClientMessage(playerid, -1"/fb <car id>");
        }
        if(
DestroyVehicle(strval(cmdtext[4])) == 0) {
            return 
SendClientMessage(playerid, -1"Invalid vehicleid!");
        }
        return 
SendClientMessage(playerid, -1"Vehicle destroyed!");
    } 
Nero_3D is offline   Reply With Quote
Old 31/05/2017, 10:47 PM   #16
tekass
Little Clucker
 
Join Date: May 2017
Posts: 21
Reputation: 0
Default Re: How to use "DestroyVehicle" whitout player in vehicle?

Hum...Thanks for your help, there are no error and your command is functional, but all commands in my script doesn't work... haha... only your commande.

You have the solution please? ^^'
tekass is offline   Reply With Quote
Old 31/05/2017, 11:25 PM   #17
Nero_3D
High-roller
 
Nero_3D's Avatar
 
Join Date: Jun 2007
Location: Germany
Posts: 2,849
Reputation: 675
Default Re: How to use "DestroyVehicle" whitout player in vehicle?

No clue, could be anything, but adding other strcmp commands like that should work
PHP Code:
//
    
if(strcmp(cmdtext"/hello1"true) == 0) {
        return 
SendClientMessage(playerid, -1"Hello1");
    }
    if(
strcmp(cmdtext,"/fb"true3) == && cmdtext[3] <= ' ') {
        if(
cmdtext[3] == EOS || cmdtext[4] == EOS) {
            return 
SendClientMessage(playerid, -1"/fb <car id>");
        }
        if(
DestroyVehicle(strval(cmdtext[4])) == 0) {
            return 
SendClientMessage(playerid, -1"Invalid vehicleid!");
        }
        return 
SendClientMessage(playerid, -1"Vehicle destroyed!");
    }
    if(
strcmp(cmdtext"/hello2"true) == 0) {
        return 
SendClientMessage(playerid, -1"Hello2");
    } 
if /hello1 and /hello2 is working that the problem is within your code

So if your other commands are also strcmp based they should work
Nero_3D is offline   Reply With Quote
Old 01/06/2017, 12:00 AM   #18
ShihabSoft
Banned
 
Join Date: Jun 2016
Posts: 156
Reputation: 8
Default Re: How to use "DestroyVehicle" whitout player in vehicle?

Quote:
if(strcmp(cmdtext,"/fb", true, 3) == 0 && cmdtext[3] <= ' ') {
What if the command the user entered is just of 3 characters, just /fb, then the cmdtext[3] would crash, with an array index out of bounds exception. It's better to use sscanf for these purposes. NEVER TRUST USER INPUT.
ShihabSoft is offline   Reply With Quote
Old 01/06/2017, 01:03 AM   #19
tekass
Little Clucker
 
Join Date: May 2017
Posts: 21
Reputation: 0
Default Re: How to use "DestroyVehicle" whitout player in vehicle?

I put the command in another GM and it works however i am forced to put the id car for the destroy and i want for something that would allow me to detroy the vehicle at the same time as i close the crusher. If is possible

Again tanks for your help +1 for you
tekass is offline   Reply With Quote
Old 01/06/2017, 05:23 AM   #20
skuller12
Big Clucker
 
Join Date: Feb 2015
Location: Galati, Romania
Posts: 101
Reputation: 0
Default Re: How to use "DestroyVehicle" whitout player in vehicle?

#include <sscanf2>
skuller12 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 09:27 AM.


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