31.03.2016, 14:01
Hello am trying to make a cmd so player only able to use those objectids but seems like i doing something wrong because keep giving me this Invaild objectid use /attachableids hope u guys are able to help me out thanks in advance.
PHP код:
stock AttachAble(objectid)
{
switch(GetObjectModel(objectid))
{
case 19601,19843,19796: return 1;
}
return 0;
}
CMD:attachobject(playerid, params[])
{
new objectmodel, objectid, car;
if(sscanf(params, "ii", objectmodel, car))
{
SendServerMessage(playerid, "Use: /attachobject [object model] [SAMP Car ID]");
return 1;
}
if(!AttachAble(objectid))
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;
}