SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 30/11/2011, 09:49 AM   #1
Smithy
Gangsta
 
Join Date: Sep 2009
Location: Kent, England
Posts: 838
Reputation: 81
Default ZCMD Siren Not Working

I have a ZCMD siren, problem is it's not working at all. The siren isn't even sending the /me style thing it should, and I'm clueless as to a fix.

pawn Code:
CMD:siren( playerid, params[ ] )
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsACop(playerid))
            {
                new siren[65];
                new VID = GetPlayerVehicleID(playerid);
                if(!strval(params))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /siren [inside, roof, remove]");
                    SendClientMessage(playerid, COLOR_GREY, "HINT: 'off' will remove the item from your vehicle.");
                    return 1;
                }
                strmid(siren, params, 0, strlen(params), 255);
                if(strcmp(siren, "inside", true, strlen(siren)) == 0)
                {
                    if(Siren[VID] == 0)
                    {
                        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);
                        AttachObjectToVehicle(SirenObject[VID], VID, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0);
                        new string[128];
                        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)
                {
                    if(Siren[VID] == 0)
                    {
                        Siren[VID] = 1;
                        new sendername[MAX_PLAYER_NAME];
                        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);
                        new string[128];
                        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, "remove", true, strlen(siren)) == 0)
                {
                    if(Siren[VID] == 1)
                    {
                        Siren[VID] = 0;
                        new sendername[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        DestroyObject(SirenObject[VID]);
                        new string[128];
                        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 doesn't have siren!"); }
                }
            } else { SendClientMessage(playerid, COLOR_GREY, "   You are not part of a Team!"); }
        }
        return 1;
    }
Smithy is offline   Reply With Quote
Old 30/11/2011, 12:09 PM   #2
[MG]Dimi
High-roller
 
[MG]Dimi's Avatar
 
Join Date: Mar 2011
Location: Serbia
Posts: 1,239
Reputation: 144
Default Re: ZCMD Siren Not Working

ccc You already have params as parameter. You only have to check is it matching with command. This should work
pawn Code:
CMD:siren( playerid, params[])
{
    if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_GREY, "   You are not part of a Team!");
    new VID = GetPlayerVehicleID(playerid);
    if(isnull(params))
    {
        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /siren [inside, roof, remove]");
        SendClientMessage(playerid, COLOR_GREY, "HINT: 'off' will remove the item from your vehicle.");
        return 1;
    }
    if(!strcmp(params, "inside", true))
    {
        if(Siren[VID] !=0) return SendClientMessage(playerid, COLOR_GREY, "This vehicle already has a siren!");
        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);
        AttachObjectToVehicle(SirenObject[VID], VID, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0);
        new string[128];
        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);
        return 1;
    }
    if(!strcmp(params, "roof", true))
    {
        if(Siren[VID] !=0) return SendClientMessage(playerid, COLOR_GREY, "This vehicle already has a siren!");
        Siren[VID] = 1;
        new sendername[MAX_PLAYER_NAME];
        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);
        new string[128];
        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);
        return 1;
    }
    if(strcmp(params, "remove", true))
    {
        if(Siren[VID] !=1) return SendClientMessage(playerid, COLOR_GREY, "This vehicle doesn't have a siren!");
        Siren[VID] = 0;
        new sendername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        DestroyObject(SirenObject[VID]);
        new string[128];
        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;
    }
    else return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /siren [inside, roof, remove]");
}

NOTE: UNTESTED!
__________________
Scripting Admin/Account/VIP Systems for $$$ using ZCMD,dcmd, Dini, MySQL and sscanf.Scripting IRC Systems with all possible functions. (Echo channels, Chat channels, Admin channels...)Long time Experience with IRC Systems.For both offers PM me
Mini Games ServerServer IP:178.238.236.62:7777
[MG]Dimi is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ZCMD not working in samp 0.3c R5 MickJ Scripting Help 3 18/11/2011 06:08 AM
[Help] /Siren not working tony_fitto Help Archive 2 16/08/2011 01:18 AM
Somewhere in this piece of code is making all zcmd commands stop working? Donya Help Archive 0 02/07/2011 06:10 PM
Zcmd iclude isn't working properly karakana7 Help Archive 7 03/11/2010 06:25 PM
MoveObject not working (zcmd) [NTX]MikeQ Help Archive 5 01/06/2010 07:04 PM


All times are GMT. The time now is 06:21 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.