[QUESTION] What's Wrong With SetObjectMaterial In my Command
#1

Okay So I Decided I Wanted To Make a Fire Department Light Using The Normal /siren Command, If You need The Full CMD Tell Me And I'll Post It.

The Errors I Am Getting;
Код:
error 035: argument type mismatch (argument 1)
The Actual Line Of Code Thats Giving Me An Error;
Код:
SetObjectMaterial(SirenObject, 0, 18646, "matcolours", "matcolours01", 3)
Reply
#2

Show us SirenObject code, it should be like
SirenObject = CreateObject(...
Reply
#3

Here Is The Full Command

Код:
CMD:fdl(playerid, params[])
{
    if(PlayerInfo[playerid][pLeader] == 4 || PlayerInfo[playerid][pMember] == 4)
    {
        new string[128], type;
        new VID = GetPlayerVehicleID(playerid);
        if(sscanf(params, "d", type))
        {
            SendClientMessageEx(playerid, COLOR_WHITE, "Usage: /fdl [type]");
            SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 - Dashboard, 2 - Off.");
            return 1;
        }
        switch(type)
        {
        case 1:
            {
                if(Siren[VID] == 1)
                {
                    SendClientMessageEx(playerid, COLOR_GRAD2, "This Vehicles Already Has a Police Light.");
                    return 1;
                }
                 new sendername[MAX_PLAYER_NAME];
                 Siren[VID] = 1;
                 GetPlayerName(playerid, sendername, sizeof(sendername));
                 SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
                 SetObjectMaterial(SirenObject, 0, 18646, "matcolours", "matcolours01", 3)
                 AttachObjectToVehicle(SirenObject[VID], VID, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0);
                 format(string, sizeof(string), "* %s Puts a Police Light On The Dashboard.", sendername);
                 ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                return 1;
            }
        case 2:
            {
                if(Siren[VID] == 0)
                {
                    SendClientMessageEx(playerid, COLOR_GRAD2, "This Vehicle Doesn't Have a Police Light On It.");
                    return 1;
                }
                Siren[VID] = 0;
                new sendername[MAX_PLAYER_NAME];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                DestroyObject(SirenObject[VID]);
                format(string, sizeof(string), "* %s Takes Down The Police Light.", sendername);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                return 1;
            }
        default:
            {
                SendClientMessageEx(playerid, COLOR_WHITE, "Invalid Type. Usage: /pdl [type]");
                SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 - Dashboard, 2 - Off");
            }
        }
    }
    else SendClientMessageEx(playerid, COLOR_GREY, "You're not authorised to use this command.");
    return 1;
}
Reply
#4

Try
pawn Код:
SetObjectMaterial(SirenObject[VID], 0, 18646, "matcolours", "matcolours01", 3);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)