Siren problem +rep
#1

nvm fixed
Reply
#2

You have missed a bracket. Paste this instead:

pawn Код:
CMD:siren(playerid, params[])
{
    if(!strval(params))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /siren [inside, roof, off]"),SendClientMessage(playerid, COLOR_GREY, "HINT: 'off' will remove the item from your vehicle.");
    if(IsACop(playerid))
    {
        new string[128];
        new sendername[MAX_PLAYERS];
        new siren[65];
        new VID = GetPlayerVehicleID(playerid);
        strmid(siren, params, 0, strlen(params), 255);
        if(strcmp(siren, "inside", true, strlen(siren)) == 0 && Siren[VID] == 0)
        {
            Siren[VID] = 1;
            GetPlayerName(playerid, sendername, sizeof(sendername));
            SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
            AttachObjectToVehicle(SirenObject[VID], VID, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0);
            format(string, sizeof(string), "* %s puts the siren on the dashboard.", sendername);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        else return SendClientMessage(playerid, COLOR_GREY, "This vehicle already has a siren!"); }
        else if(strcmp(siren, "roof", true, strlen(siren)) == 0 && Siren[VID] == 0)
        {
            new string[128];
            new sendername[MAX_PLAYERS];
            Siren[VID] = 1;
            GetPlayerName(playerid, sendername, sizeof(sendername));
            SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
            AttachObjectToVehicle(SirenObject[VID], VID, -0.43, 0.0, 0.785, 0.0, 0.1, 0.0);
            format(string, sizeof(string), "* %s puts the siren on the roof.", sendername);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        else return SendClientMessage(playerid, COLOR_GREY, "This vehicle already has a siren!"); }
        else if(strcmp(siren, "off", true, strlen(siren)) == 0 && Siren[VID] == 1)
        {
            new string[128];
            new sendername[MAX_PLAYERS];
            Siren[VID] = 0;
            GetPlayerName(playerid, sendername, sizeof(sendername));
            DestroyObject(SirenObject[VID]);
            format(string, sizeof(string), "* %s takes down the siren.", sendername);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
    }
    return 1;
}
Reply
#3

nvm fixed
Reply
#4

pawn Код:
CMD:siren(playerid, params[])
{
    if(!strval(params))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /siren [inside, roof, off]"),SendClientMessage(playerid, COLOR_GREY, "HINT: 'off' will remove the item from your vehicle.");
    if(IsACop(playerid))
    {
        new string[128];
        new sendername[MAX_PLAYERS];
        new siren[65];
        new VID = GetPlayerVehicleID(playerid);
        strmid(siren, params, 0, strlen(params), 255);
        if(strcmp(siren, "inside", true, strlen(siren)) == 0 && Siren[VID] == 0)
        {
            Siren[VID] = 1;
            GetPlayerName(playerid, sendername, sizeof(sendername));
            SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
            AttachObjectToVehicle(SirenObject[VID], VID, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0);
            format(string, sizeof(string), "* %s puts the siren on the dashboard.", sendername);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        else if(strcmp(siren, "roof", true, strlen(siren)) == 0 && Siren[VID] == 0)
        {
            new string[128];
            new sendername[MAX_PLAYERS];
            Siren[VID] = 1;
            GetPlayerName(playerid, sendername, sizeof(sendername));
            SirenObject[VID] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
            AttachObjectToVehicle(SirenObject[VID], VID, -0.43, 0.0, 0.785, 0.0, 0.1, 0.0);
            format(string, sizeof(string), "* %s puts the siren on the roof.", sendername);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        else if(strcmp(siren, "off", true, strlen(siren)) == 0 && Siren[VID] == 1)
        {
            new string[128];
            new sendername[MAX_PLAYERS];
            Siren[VID] = 0;
            GetPlayerName(playerid, sendername, sizeof(sendername));
            DestroyObject(SirenObject[VID]);
            format(string, sizeof(string), "* %s takes down the siren.", sendername);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        else return SendClientMessage(playerid, COLOR_GREY, "This vehicle already has a siren!");
    }
    return 1;
}
You should only return after you did all strcmp-checks, otherwise it seriously won't work. Also you close the code too early.
Reply
#5

Your both wrong, use this:
Код:
new Siren1
new Siren2
new Siren3

CMD:siren(playerid, params[]) {
         if(PlayerSirenDefinesOntopOfPoliceCar))
         {
              SendClientMessage(playerid, COLOR_RED, "Siren On");
         }
         return 1;
}
That will work ^ ^
Reply
#6

Quote:
Originally Posted by Jordiee
Посмотреть сообщение
Your both wrong, use this:
Код:
new Siren1
new Siren2
new Siren3

CMD:siren(playerid, params[]) {
         if(PlayerSirenDefinesOntopOfPoliceCar))
         {
              SendClientMessage(playerid, COLOR_RED, "Siren On");
         }
         return 1;
}
That will work ^ ^
I LOL'd Hard at this.
Reply
#7

nvm fixed
Reply


Forum Jump:


Users browsing this thread: