ZCMD To Strcmp [+REP]
#1

my script won't run this one
Код:
new Siren[MAX_VEHICLES];
new SirenObject[MAX_VEHICLES];






CMD:siren(playerid, params[])
{
	if(IsACop(playerid))
	{
		new string[128], type;
		new VID = GetPlayerVehicleID(playerid);
		if(sscanf(params, "d", type))
		{
			SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /siren [type]");
			SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 = Inside, 2 = Roof, 3 = Off.");
			return 1;
		}
		switch(type)
		{
		case 1:
			{
				if(Siren[VID] == 1)
				{
					SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle already has a siren!");
					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);
                 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);
				return 1;
			}
		case 2:
			{
				if(Siren[VID] == 1)
				{
					SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle already has a siren!");
					return 1;
				}
                        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);
                        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;
			}
		case 3:
			{
				if(Siren[VID] == 0)
				{
					SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle doesn't have a siren 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 siren.", sendername);
               	ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				return 1;
			}
		default:
			{
				SendClientMessageEx(playerid, COLOR_WHITE, "Invalid license type! /siren [type]");
				SendClientMessageEx(playerid, COLOR_GRAD2, "Type: 1 = Roof, 2 = Inside, 3 = Off.");
			}
		}
	}
	else SendClientMessageEx(playerid, COLOR_GREY, "You're not authorised to use this command.");
	return 1;
now i have it on zcmd, and it works but i can't add it in my script because im working with the other one

all my commands are with if (strcmp("/siren", cmdtext, true, 10) == 0)

but that full script is in ZCMD
can some one fix this one, and if it's possible with the right align's
i would be so happy!
Reply
#2

Change this: CMDiren(playerid, params[])
into this: if (strcmp("/siren", cmdtext, true, 10) == 0) You did the work for yourself already -.-
Reply
#3

No. It's like installing Windows95 on a Windows 7 PC. Do it the other way round.
Reply
#4

Quote:
Originally Posted by thimo
Посмотреть сообщение
Change this: CMDiren(playerid, params[])
into this: if (strcmp("/siren", cmdtext, true, 10) == 0) You did the work for yourself already -.-
if i do that, it say's compailer libary won't work anymore.

what to do.
Reply
#5

pawn Код:
if(strcmp(cmd, "/siren", true) == 0)
    {
        if(!IsValidObject(Siren[playerid]))
        {
            if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
            {
                new siren[65];
                new VID = GetPlayerVehicleID(playerid);
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GREY, "USAGE: /siren [inside, roof, nothing]");
                    SendClientMessage(playerid, COLOR_GREY, "[INFO]: 'nothing' will remove the item from your vehicle!");
                    return 1;
                }
                strmid(siren, tmp, 0, strlen(cmdtext), 255);
                if(strcmp(siren, "inside", true, strlen(siren)) == 0)
                {
                    if(Siren[playerid] != INVALID_OBJECT_ID)
                    {
                        if(VID != 426) { return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to be in a Premier model!"); } // If he's not in a Premier...
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        Siren[playerid] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
                        AttachObjectToVehicle(Siren[playerid], VID, 0.0, 0.75, 0.275, 0.0, 0.1, 0.0); // Inside - Premier
                        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, "[INFO]: You do already have a siren..."); }
                }
                else if(strcmp(siren, "roof", true, strlen(siren)) == 0)
                {
                    if( Siren[playerid] != INVALID_OBJECT_ID )
                    {
                        if(VID != 426) { return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to be in a Premier model!"); } // If he's not in a Premier...
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        Siren[playerid] = CreateObject(18646, 10.0, 10.0, 10.0, 0, 0, 0);
                        AttachObjectToVehicle(Siren[playerid], VID, -0.43, 0.0, 0.785, 0.0, 0.1, 0.0); // tak - Premier
                        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, "[INFO]: You do already have a siren..."); }
                }
                else if(strcmp(siren, "nothing", true, strlen(siren)) == 0)
                {
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    DestroyObject(Siren[playerid]);
                    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 { SendClientMessage(playerid, COLOR_GREY, "[INFO]: Are you a cop?"); }
        }
        return 1;
    }
edit the variables to fit your script.
Reply
#6

it keep saying pawno doesn't work anymore, i think there are to much error's if i add it.
Reply
#7

Quote:
Originally Posted by Frank Biohazard
Посмотреть сообщение
it keep saying pawno doesn't work anymore, i think there are to much error's if i add it.
Again, I am repeating, Zcmd will not work with Strcmp. You have to remove ZCMD if you want to use Strcmp, and remove strcmp if you want to use Zcmd.. If you know what i mean..

-FalconX
Reply
#8

i have both but not #included, at the other script i have not ZCMD included, and if i run this one with ZCMD in filterscript INCLUDED i need to add more new and included but i don't know what to add, so i wanna use this script but i can't cause of the zmcd and strcmp

how will it work
Reply
#9

You can't use zcmd and strcmd in one script, you can run zcmd in a filterscript and strcmd in a gamemode but it might turn out to be buggy.
Reply
#10

The compiler goes to the "not responding" state when it's compiling. Give it some time, this is absolutely normal.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)