PHP код:
AttachAble(objectmodel)
{
switch(objectmodel)
{
case 19601,19843,19796: return 1;
}
return 0;
}
CMD:attachobject(playerid, params[])
{
new objectmodel, car;
if(sscanf(params, "ii", objectmodel, car))
{
SendServerMessage(playerid, "Use: /attachobject [object model] [SAMP Car ID]");
return 1;
}
if(!AttachAble(objectmodel))
return SendErrorMessage(playerid, "Invaild objectid use /attachableids");
if(0 < car < MAX_VEHICLES)
{
new Float:px, Float:py, Float:pz;
GetPlayerPos(playerid, px, py, pz);
AttachingObjects[playerid] = CreateObject(objectmodel, px, py, pz, 0.0, 0.0, 0.0);
SendClientMessage(playerid, 0xfce80cFF, "Object created. Editing...");
EditObject(playerid, AttachingObjects[playerid]);
SetPVarInt(playerid, "AttachingTo", car);
}
else
{
SendErrorMessage(playerid, "Invalid vehicle");
}
return 1;
}
You should use object model in every where not getting object model id, cause you're not attaching object on your car, you creating new one, so