SA-MP Forums Archive
fixveh command - 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: fixveh command (/showthread.php?tid=454756)



fixveh command - Jhony_Blaze - 30.07.2013

Hello, I am trying to do a vehicle fix admin command filterscript, but I am getting errors, here it's the script

Код:
#include <a_samp>


#define fixvehall
#define IsPlayerLoggedIn
#define playerid
#define PlayerInfo
#define playerid
#define COLOR_GREY


public OnFilterScriptInit()
{

CMD:fixvehall(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid))) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");
    for(new i = 0; i < MAX_VEHICLES; i++)
    if(sscanf(params,"s[32]", params))
    {
    
       //SetVehicleHealth(i, 1000.0);
	   RepairVehicle(i);
	
	{
	
       SendClientMessage(playerid, COLOR_GREY, "All vehicles fixed.");
       return 1;
       
	}
	
CMD:fixveh (playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid))) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");
	if(IsPlayerInAnyVehicle(playerid))
    {
    
        RepairVehicle(GetPlayerVehicleID(playerid));
        SendClientMessage(playerid, COLOR_GREY, "   You have fixed your vehicle !");
	{
	
		}
		return 1;

And these are the errors

Код:
C:\Documents and Settings\Administrator\Desktop\test.pwn(15) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\test.pwn(15) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\test.pwn(17) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\test.pwn(17) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\test.pwn(18) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\test.pwn(18) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\test.pwn(18) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\test.pwn(18) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


8 Errors.
Please, tell me what I am doing wrong, thanks !


Re: fixveh command - JimmyCh - 30.07.2013

Alright try this:
pawn Код:
#include <a_samp>


#define fixvehall
#define IsPlayerLoggedIn
#define playerid
#define PlayerInfo
#define playerid
#define COLOR_GREY


public OnFilterScriptInit()
{
return 1;
}

CMD:fixvehall(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid))) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");
    for(new i = 0; i < MAX_VEHICLES; i++)
    {
    SetVehicleHealth(i, 1000.0);
    RepairVehicle(i);
    SendClientMessage(playerid, COLOR_GREY, "All vehicles fixed.");
    return 1;  
    }
    return 1;
}

CMD:fixveh (playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid))) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");
    if(IsPlayerInAnyVehicle(playerid))
    {
    RepairVehicle(GetPlayerVehicleID(playerid));
    SendClientMessage(playerid, COLOR_GREY, "   You have fixed your vehicle !");
    }
    return 1;
}
Tell me if you get any error.


Re: fixveh command - Jimmy0wns - 30.07.2013

You removed a bit from FilterscriptInit and its not defined as a filterscript.


Re: fixveh command - morocco - 30.07.2013

add

pawn Код:
public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}
and you will get many error
Go learn about " How to use zcmd "


Re: fixveh command - Jhony_Blaze - 30.07.2013

Yup, these are the errors



Код:
C:\Documents and Settings\Administrator\Desktop\test.pwn(17) : error 020: invalid symbol name ""
C:\Documents and Settings\Administrator\Desktop\test.pwn(19) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\test.pwn(20) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\test.pwn(21) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\test.pwn(22) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\test.pwn(27) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\test.pwn(29) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\test.pwn(32) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\test.pwn(32) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\test.pwn(34) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\test.pwn(35) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\test.pwn(36) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\test.pwn(37) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\test.pwn(42) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\test.pwn(44) : warning 203: symbol is never used: "fixveh"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


14 Errors.



Re: fixveh command - JimmyCh - 30.07.2013

Dude, is this part of your script or all of it?
Because no way:
Код:
if(!aDuty[playerid])
will work if it's a filterscript.
You don't have it anywhere.


Re: fixveh command - Jhony_Blaze - 30.07.2013

well its just a part of it, but if I am going to implement it in the gamemode, I will get it work ?


Re: fixveh command - Konstantinos - 30.07.2013

Quote:
Originally Posted by JimmyCh
Посмотреть сообщение
Alright try this:
pawn Код:
#include <a_samp>


#define fixvehall
#define IsPlayerLoggedIn
#define playerid
#define PlayerInfo
#define playerid
#define COLOR_GREY


public OnFilterScriptInit()
{
return 1;
}

CMD:fixvehall(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid))) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");
    for(new i = 0; i < MAX_VEHICLES; i++)
    {
    SetVehicleHealth(i, 1000.0);
    RepairVehicle(i);
    SendClientMessage(playerid, COLOR_GREY, "All vehicles fixed.");
    return 1;  
    }
    return 1;
}

CMD:fixveh (playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid))) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");
    if(IsPlayerInAnyVehicle(playerid))
    {
    RepairVehicle(GetPlayerVehicleID(playerid));
    SendClientMessage(playerid, COLOR_GREY, "   You have fixed your vehicle !");
    }
    return 1;
}
Tell me if you get any error.
A LOT of them..

You have done so many mistakes, not including zcmd and sscanf (you don't need it actually). When it gives you errors for "undefined symbols", the way to fix them is to declare them, not using
pawn Код:
#define THE_SYMBOL_NAME_I_GOT_ERROR
Anyways, I fixed the errors/warnings, but you should edit it to your needs.

pawn Код:
#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>

#undef MAX_PLAYERS
#define MAX_PLAYERS 50 // CHANGE IT

#define COLOR_GREY 0x7F7F7FFF

enum pInfo
{
    bool: pLoggedIn,
    pAdmin
};

new
    PlayerInfo[ MAX_PLAYERS ][ pInfo ],
    bool: aDuty[ MAX_PLAYERS ]
;

CMD:fixvehall(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");
    for(new i = 0; i < MAX_VEHICLES; i++)
    {
       //SetVehicleHealth(i, 1000.0);
       RepairVehicle(i);

    }
    SendClientMessage(playerid, COLOR_GREY, "All vehicles fixed.");
    return 1;
}

CMD:fixveh (playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");
    if(IsPlayerInAnyVehicle(playerid))
    {
        RepairVehicle(GetPlayerVehicleID(playerid));
        SendClientMessage(playerid, COLOR_GREY, "   You have fixed your vehicle !");
    }
    return 1;
}

stock IsPlayerLoggedIn(playerid)
{
    // CHANGE THIS TO THE VARIABLE YOU HAVE FOR CHECKING IF HE'S LOGGED IN
    if(PlayerInfo[playerid][pLoggedIn]) return 1;
    return 0;
}



Re: fixveh command - JimmyCh - 30.07.2013

Okay so I made it for you a filterscript, but only for RCON admins(You can't put Aduty and stuff if it's not in your gamemode.
This will work for sure.(AS A FILTERSCRIPT)
Here it is:
pawn Код:
#include <a_samp>
#include <zcmd>

#define FILTERSCRIPT

#define COLOR_GREY  0x00000041

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Vehicle fix by Jimmy to Jhony :D");
    print("--------------------------------------\n");
    return 1;
}

CMD:fixvehall(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    for(new i = 0; i < MAX_VEHICLES; i++)
    {
    SetVehicleHealth(i, 1000.0);
    RepairVehicle(i);
    SendClientMessage(playerid, COLOR_GREY, "All vehicles fixed.");
    return 1;
    }
    return 1;
}


CMD:fixveh (playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(IsPlayerInAnyVehicle(playerid))
    {
    RepairVehicle(GetPlayerVehicleID(playerid));
    SendClientMessage(playerid, COLOR_GREY, "   You have fixed your vehicle !");
    }
    return 1;
}



Re: fixveh command - Jhony_Blaze - 30.07.2013

Thank you guys, it worked now as filterscript and in the gamemode too. +rep!