SA-MP Forums Archive
undefined symbol "vehicleid" 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: undefined symbol "vehicleid" HELP! (/showthread.php?tid=336764)



undefined symbol "vehicleid" HELP! - VanillaRain - 23.04.2012

i have this code

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		TuneVehicleRandomly(vehicleid);
    return SendClientMessage(playerid,-1,"Your car has been tuned.");
		return 1;
	}
	return 0;
}
when i compile my code pawn says

Код:
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(212) : error 017: undefined symbol "vehicleid"
how can i solve this?

Please help!


Re: undefined symbol "vehicleid" HELP! - Scripter12345 - 23.04.2012

Quote:
Originally Posted by VanillaRain
Посмотреть сообщение
i have this code

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
                vehicleid = GetPlayerVehicle;
		TuneVehicleRandomly(vehicleid);
    return SendClientMessage(playerid,-1,"Your car has been tuned.");
		return 1;
	}
	return 0;
}
when i compile my code pawn says

Код:
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(212) : error 017: undefined symbol "vehicleid"
how can i solve this?

Please help!
This should work


pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
                vehicleid = GetPlayerVehicle;
        TuneVehicleRandomly(vehicleid);
    return SendClientMessage(playerid,-1,"Your car has been tuned.");
        return 1;
    }
    return 0;
}



AW: undefined symbol "vehicleid" HELP! - BigETI - 23.04.2012

Use GetPlayerVehicleID


Respuesta: undefined symbol "vehicleid" HELP! - Francis. - 23.04.2012

Change this:
pawn Код:
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        TuneVehicleRandomly(vehicleid);
        return SendClientMessage(playerid,-1,"Your car has been tuned.");
        return 1;
    }
for this:
pawn Код:
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid)){
            TuneVehicleRandomly(GetPlayerVehicleID(playerid));
            SendClientMessage(playerid,-1,"Your car has been tuned.");
            return 1;
        } else return SendClientMessage(playerid, 0xFF0000FF, "You are not in a car."),1;
    }



Re: undefined symbol "vehicleid" HELP! - Calgon - 23.04.2012

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "Your car has not been tuned as you're not in one.");
        TuneVehicleRandomly(GetPlayerVehicleID(playerid));
        return SendClientMessage(playerid,-1,"Your car has been tuned.");
    }
    return 0;
}
Using GetPlayerVehicleID() informs the script of the vehicle ID you want. It selects the vehicle ID the player is currently in who executes the command.

I've added a check to ensure the player is even in a vehicle too, and removed the pointless return.


Re: undefined symbol "vehicleid" HELP! - VanillaRain - 23.04.2012

Quote:
Originally Posted by Scripter12345
Посмотреть сообщение
This should work


pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
                vehicleid = GetPlayerVehicle;
        TuneVehicleRandomly(vehicleid);
    return SendClientMessage(playerid,-1,"Your car has been tuned.");
        return 1;
    }
    return 0;
}
Код:
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(32) : warning 217: loose indentation
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(41) : warning 217: loose indentation
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(41) : warning 213: tag mismatch
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(208) : error 017: undefined symbol "vehicleid"
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(208) : error 017: undefined symbol "GetPlayerVehicle"
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(208) : warning 215: expression has no effect
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(209) : warning 217: loose indentation
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(209) : error 017: undefined symbol "vehicleid"
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(210) : warning 217: loose indentation
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(211) : warning 225: unreachable code
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(211) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.



Re: Respuesta: undefined symbol "vehicleid" HELP! - VanillaRain - 23.04.2012

Quote:
Originally Posted by Francis.
Посмотреть сообщение
Change this:
pawn Код:
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        TuneVehicleRandomly(vehicleid);
        return SendClientMessage(playerid,-1,"Your car has been tuned.");
        return 1;
    }
for this:
pawn Код:
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid)){
            TuneVehicleRandomly(GetPlayerVehicleID(playerid));
            SendClientMessage(playerid,-1,"Your car has been tuned.");
            return 1;
        } else return SendClientMessage(playerid, 0xFF0000FF, "You are not in a car."),1;
    }
Код:
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(32) : warning 217: loose indentation
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(41) : warning 217: loose indentation
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(41) : warning 213: tag mismatch
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(204) : error 010: invalid function or declaration
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(206) : error 010: invalid function or declaration
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(207) : error 021: symbol already defined: "TuneVehicleRandomly"
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(207) : error 017: undefined symbol "playerid"
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(207) : error 010: invalid function or declaration
C:\Users\Acer\Desktop\sЂrvЂr\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\filterscripts\randomtuning.pwn(207 -- 209) : fatal error 107: too many error messages on one line

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


6 Errors.



Re: undefined symbol "vehicleid" HELP! - Calgon - 23.04.2012

Try the code I provided, I even explained it.


Re: undefined symbol "vehicleid" HELP! - VanillaRain - 23.04.2012

Quote:
Originally Posted by Calgon
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "Your car has not been tuned as you're not in one.");
        TuneVehicleRandomly(GetPlayerVehicleID(playerid));
        return SendClientMessage(playerid,-1,"Your car has been tuned.");
    }
    return 0;
}
Using GetPlayerVehicleID() informs the script of the vehicle ID you want. It selects the vehicle ID the player is currently in who executes the command.

I've added a check to ensure the player is even in a vehicle too, and removed the pointless return.

THANKS A LOT MAN THIS WORK!!

THANK ANYWAYS TO ALL OTHERS THAT HAVE HELPED ME OUT!