SA-MP Forums Archive
Help? attach object to car - 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: Help? attach object to car (/showthread.php?tid=493826)



Help? attach object to car - eblood1 - 10.02.2014

How i can make this work.. and work with the sabre car only?

pawn Код:
CMD:sabre(playerid,params[])
{
    #pragma unused params
    new objectid = CreateObject);
    new vehicleid = GetPlayerVehicleID(playerid);
    AttachObjectToVehicle(objectid, vehicleid, -0.159999, 1.339998, -0.124999, -135.674880, -2.010001, -90.449951);
    AttachObjectToVehicle(objectid, vehicleid, -0.150000, 1.504998, -0.124999, -135.674880, -2.010001, -90.449951);
    return 1;
}



Re: Help? attach object to car - TheSnaKe - 10.02.2014

Am not use but i think you have to add something like this in your code.
Код:
if(GetVehicleModel(vehicleid) == 475
475 is the car id (sabre)


Re: Help? attach object to car - eblood1 - 10.02.2014

Quote:
Originally Posted by TheSnaKe
Посмотреть сообщение
Am not use but i think you have to add something like this in your code.
Код:
if(GetVehicleModel(vehicleid) == 475
475 is the car id (sabre)
i get this errors
Код:
C:\Users\Administrator\Desktop\Extreme Stunting\gamemodes\StuntGM_XS.pwn(4994) : error 017: undefined symbol "vehicleid"
C:\Users\Administrator\Desktop\Extreme Stunting\gamemodes\StuntGM_XS.pwn(4995) : error 003: declaration of a local variable must appear in a compound block
C:\Users\Administrator\Desktop\Extreme Stunting\gamemodes\StuntGM_XS.pwn(4995) : error 017: undefined symbol "objectid"
C:\Users\Administrator\Desktop\Extreme Stunting\gamemodes\StuntGM_XS.pwn(4995 -- 4996) : error 076: syntax error in the expression, or invalid function call
C:\Users\Administrator\Desktop\Extreme Stunting\gamemodes\StuntGM_XS.pwn(4995 -- 4996) : fatal error 107: too many error messages on one line

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


5 Errors.



Re: Help? attach object to car - Threshold - 10.02.2014

pawn Код:
CMD:sabre(playerid,params[])
{
    #pragma unused params
    new objectid = CreateObject(/*objectid, x, y, z,...*/);
    new vehicleid = GetPlayerVehicleID(playerid);
    if(vehicleid == INVALID_VEHICLE_ID) return SendClientMessage(playerid, 0xFF0000FF, "You must be in a vehicle to use this command.");
    if(GetVehicleModel(vehicleid) != 475) return SendClientMessage(playerid, 0xFF0000FF, "You must be in a sabre to use this command.");
    AttachObjectToVehicle(objectid, vehicleid, -0.159999, 1.339998, -0.124999, -135.674880, -2.010001, -90.449951);
    AttachObjectToVehicle(objectid, vehicleid, -0.150000, 1.504998, -0.124999, -135.674880, -2.010001, -90.449951);
    return 1;
}