CMD Help!
#1

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++)
    {
        if(SpeedCams[idx][scX] == 0)
        {
            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;
            }
        }
        return 1;
    }
    //SendClientMessage(playerid, COLOR_ORANGE, "Reached Maximum Cams [10].");
    return 1;
}
This code should generate a camera till it gets to the MAX_CAMS which is 10.

Ths problem is that the command doesn't work properly. when i use /deploycam , it will deploy 1 camera and afterward if i try to deploying another cam it wouldn't deploy the 2nd. Plus --> couldn't make this command to work with sending a message after the player gets to maximum cams... Please help me fix this cmd!
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)