SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 26/02/2020, 10:16 AM   #1
Ryder31
Little Clucker
 
Ryder31's Avatar
 
Join Date: Feb 2020
Posts: 1
Reputation: 0
Default Fix Vehicle [Rcon Only]

Hey guys i made a Fix Vehicle filterscript only for rcon try it
remember guys you need first login with rcon /rcon login (password)



if(strcmp(cmdtext,"/fix",true) == 0)
{
if(GetPlayerState != PLAYER_STATE_DRIVER) return SendClientMessage(playerid,red,"You need to be driving a vehicle!");
SetVehicleHealth(GetPlayerVehicleID(playerid),1000 );
SendClientMessage(playerid,COLOR_YELLOW,"Vehicle fixed");
return 1;
}


Credits:
Conpop
Ryder


Enjoy!
Ryder31 is offline   Reply With Quote
Old 26/02/2020, 12:43 PM   #2
cuber
Gangsta
 
cuber's Avatar
 
Join Date: Oct 2016
Posts: 822
Reputation: 197
Default Re: Fix Vehicle [Rcon Only]

Only for rcon? Hm...
__________________
Continuous Deathmatch
cuber is offline   Reply With Quote
Old 26/02/2020, 12:50 PM   #3
l0gic
Big Clucker
 
Join Date: Aug 2019
Posts: 105
Reputation: 16
Default Re: Fix Vehicle [Rcon Only]

Please stop posting this garbage, yeah we get it, you wrote your first command that does something, but nobody doesnt care. Just learn coding for yourself and improve your skills and then create full solution.
__________________
Coding experience with: PAWN, Java, Python, Javascript, PHP and SQL for about 6 years.
l0gic is offline   Reply With Quote
Old 26/02/2020, 02:35 PM   #4
Kwarde
High-roller
 
Kwarde's Avatar
 
Join Date: Nov 2009
Location: The Netherlands
Posts: 2,529
Reputation: 1642
Default Re: Fix Vehicle [Rcon Only]

Quote:
Originally Posted by l0gic View Post
Please stop posting this garbage, yeah we get it, you wrote your first command that does something, but nobody doesnt care. Just learn coding for yourself and improve your skills and then create full solution.
Nobody doesn't care? So we all care?

Aside from this a few other notes:

1- There is no check if a player is logged into RCON [IsPlayerAdmin()], so everyone can use the command.
2- Using strcmp() under OnPlayerCommandText() is kinda very outdated, you should consider using a command processor. (Examples: Pawn.CMD, y_commands, i-zcmd)
3- When posting code it is desirable to use one of these BBCodes to put the code in:
Code:
[code(])
Code here (No highlighting but still prettier to read, plus indentation)
[/code(])

[php(]
PHP Code here (PHP highlighting, indentation)
[/php(])

[pawn(])
PAWN Code here (PAWN highlighting, indentation)
[/pawn(])
//Off course, remove the )( brackets.
4- You posted this as a filterscript, but there are no public functions (entry points). This is merely a snippet. I believe there's a seperate topic for that.
5- Under SendClientMessage() you are using 'red' as a color. You should include such defined things. Now not including a color isn't that bad since almost everyone uses it. I, however, for example, use 'COLOR_RED' so if point 4 was OK, I still wouldn't be able to compile

Here's an example on point 3.
The way you posted:

#if !defined ENV
#error ENV must be defined!
#else
#pragma warning disable 214,239
#if ENV < 0 || ENV > 3
#error Invalid option for ENV (must be 0-3)
#elseif ENV == 0
#pragma option -C-
#pragma option -d3
#pragma option -R+
#pragma option -v2
#elseif ENV == 1
#pragma option -C-
#pragma option -d3
#pragma option -v2
#elseif ENV == 2
#if !defined USE_JIT
#pragma option -O0
#endif
#pragma option -E+
#elseif ENV == 3
#pragma option -d0
#if !defined USE_JIT
#pragma option -O0
#endif
#pragma option -v0
#pragma option -E+
#endif
#endif
//This is a comment. Here is some more code below:
kprint(const string[])
{
#if ENV < 3
print(string);
#else
#pragma unused string
#endif
}
#if ENV < 3
native kprintf(const format[], {Float,_}:...) = printf;
#else
kprintf(const format[], {Float,_}:...)
{
#pragma unused format
}
#endif

Posting using the PAWN BBcode:
pawn Code:
#if !defined ENV
    #error ENV must be defined!
#else
    #pragma warning disable 214,239
    #if ENV < 0 || ENV > 3
        #error Invalid option for ENV (must be 0-3)
    #elseif ENV == 0
        #pragma option -C-
        #pragma option -d3
        #pragma option -R+
        #pragma option -v2
    #elseif ENV == 1
        #pragma option -C-
        #pragma option -d3
        #pragma option -v2
    #elseif ENV == 2
        #if !defined USE_JIT
            #pragma option -O0
        #endif
        #pragma option -E+
    #elseif ENV == 3
        #pragma option -d0
        #if !defined USE_JIT
            #pragma option -O0
        #endif
        #pragma option -v0
        #pragma option -E+
    #endif
#endif
//This is a comment. Here is some more code below:
kprint(const string[])
{
    #if ENV < 3
    print(string);
    #else
        #pragma unused string
    #endif
}
#if ENV < 3
native kprintf(const format[], {Float,_}:...) = printf;
#else
kprintf(const format[], {Float,_}:...)
{
    #pragma unused format
}
#endif

Nobody likes reading code the first method. Second one all the way.
__________________
Do not click on this URL -It is secret information
RIP Slayer 1981-2019 \m/

Last edited by Kwarde; 26/02/2020 at 02:44 PM. Reason: Missing an #endif. Though merely a BBCode usage example, not going to post incorrect code.
Kwarde is offline   Reply With Quote
Old 29/02/2020, 05:28 PM   #5
SiaReyes
Gangsta
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 621
Reputation: 57
Default Re: Fix Vehicle [Rcon Only]

Quote:
Originally Posted by cuber View Post
Only for rcon? Hm...
huh? there is no rcon check even!
SiaReyes is offline   Reply With Quote
Old 29/02/2020, 07:09 PM   #6
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 819
Reputation: 68
Default Re: Fix Vehicle [Rcon Only]

When you release a command to fix a vehicle but only allowed to RCON admins:



But after you realize there is no RCON check:

__________________


"A server owner shouldn't be embarrassed or have fear to request help, because we're humans and we never stop learning."
Symon 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
When login rcon in game it says you are not authorized to use this command but i rcon or owner Dejan12345 Scripting Help 5 08/08/2016 12:36 PM
Vehicle disappear when do rcon gmx sjames Scripting Help 1 07/08/2015 10:05 AM
[FilterScript] [R.P.S] Rcon Protection System (/rSenha) [/rcon login = kick] Diogo_Bras Lanšamentos/Releases 14 30/04/2011 03:57 PM
Cannot login into RCON, /vehicle also? Spiral Help Archive 3 20/02/2011 09:21 AM


All times are GMT. The time now is 12:29 AM.


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