CMD Help!
#4

Quote:
Originally Posted by Zamora
Посмотреть сообщение
Try this code

pawn Код:
CMD:deploycam(playerid, params[])
{
    new string[128], limit;
    if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(sscanf(params, "d", limit)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /deploycam [speed]");
    for(new idx=1; idx<MAX_CAMS; idx++) //for(new idx=1; idx<MAX_GATES; idx++)
    {

            GetPlayerPos(playerid, SpeedCams[idx][scX], SpeedCams[idx][scY], SpeedCams[idx][scZ]);
            GetPlayerFacingAngle(playerid, SpeedCams[idx][fCamAngle]);
            SpeedCams[idx][scObjectID] = CreateDynamicObject(18880, SpeedCams[idx][scX], SpeedCams[idx][scY], SpeedCams[idx][scZ]-2.0, 0.0, 0.0, SpeedCams[idx][fCamAngle]);
            GetPlayer3DZone(playerid, SpeedCams[idx][scDeployedAt], MAX_ZONE_NAME);
            SpeedCams[idx][scDeployedBy] = RPN(playerid);
            SpeedCams[idx][scLimit] = limit;
            format(string,sizeof(string),"Speed Cam ID: %d successfully created [Speed Limit = %d].", idx, limit);
            SendClientMessage(playerid, COLOR_WHITE, string);
            format(string, sizeof(string), "HQ: A speeding camera has been deployed by %s at %s (%d).", RPN(playerid), SpeedCams[idx][scDeployedAt], SpeedCams[idx][scLimit]);
            foreach(Player, x)
            {
                if(IsACop(x))
                {
                    SendClientMessage(x, TRANSPARENT_BLUE, string);
                    if (PlayerInfo[x][pFacRank] >= 5)
                    {
                        SendClientMessage(x, COLOR_YELLOW, "You can remove a speed camera by typing /destroycam.");
                    }
                }
                return 1;
            }
       
    }
    SendClientMessage(playerid, COLOR_ORANGE, "Reached Maximum Cams [10].");
    return 1;
}
This code gave the option to deploy more then 1 Camera.
But then all the others are stuck for CAM ID:1 ... every /deploycam makes another ID:1.

I want it work like this :

/deploycam
will send message (CAM ID:1 DEPLOYED)
/deploycam
will send message (CAM ID:2 DEPLOYED)

Untill it gets to the MAX_CAMS i defined above.


Any solution?
Reply


Messages In This Thread
CMD Help! - by maximthepain - 15.12.2013, 07:12
Re: CMD Help! - by Zamora - 15.12.2013, 08:48
Re: CMD Help! - by Zamora - 15.12.2013, 09:01
Re: CMD Help! - by maximthepain - 15.12.2013, 19:55
Re: CMD Help! - by maximthepain - 15.12.2013, 20:16

Forum Jump:


Users browsing this thread: 1 Guest(s)