strcmp problem
#1

pawn Код:
CMD:v(playerid, params[])
{
    new engine, lights, alarm, doors, bonnet, boot, objective, string[96], vehicleid = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to be inside a vehicle to use this command!");
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You need to be driving the vehicle to use this command!");
    if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "[USAGE]: /v [hood/trunk/lights]");
    if(!isnull(params)) {
        if(!strcmp(params, "hood", true)) {
            if(bonnet == 0) {
                format(string, sizeof(string), "* %s has opened the hood.", GetPlayerNameEx(playerid));
                ProxDetector(20.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, 1, boot, objective);
                GameTextForPlayer(playerid, "~g~VEHICLE HOOD OPENED!", 3000, 1);
            }
            else if(bonnet == 1) {
                format(string, sizeof(string), "* %s has closed the hood.", GetPlayerNameEx(playerid));
                ProxDetector(20.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, 0, boot, objective);
                SendClientMessage(playerid, COLOR_LIGHTGREEN, "You have closed the hood! (/chood to open it)");
                GameTextForPlayer(playerid, "~w~VEHICLE HOOD CLOSED!", 3000, 1);
            }
        }
        if(!strcmp(params, "trunk", true)) {
            if(bonnet == 0) {
                format(string, sizeof(string), "* %s has opened the trunk.", GetPlayerNameEx(playerid));
                ProxDetector(20.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, 1, objective);
                GameTextForPlayer(playerid, "~g~VEHICLE TRUNK CLOSED!", 3000, 1);
            }
            else if(bonnet == 1) {
                format(string, sizeof(string), "* %s has closed the trunk.", GetPlayerNameEx(playerid));
                ProxDetector(20.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, 0, objective);
                GameTextForPlayer(playerid, "~w~VEHICLE TRUNK CLOSED!", 3000, 1);
            }
        }
        if(!strcmp(params, "lights", true)) {
            if(lights == 0) {
                format(string, sizeof(string), "* %s has turned on the vehicle lights.", GetPlayerNameEx(playerid));
                ProxDetector(20.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(vehicleid, engine, 1, alarm, doors, bonnet, boot, objective);
                GameTextForPlayer(playerid, "~g~VEHICLE LIGHTS ON!", 3000, 1);
            }
            else if(lights == 1) {
                format(string, sizeof(string), "* %s has turned off the vehicle lights.", GetPlayerNameEx(playerid));
                ProxDetector(20.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(vehicleid, engine, 0, alarm, doors, bonnet, boot, objective);
                GameTextForPlayer(playerid, "~w~VEHICLE LIGHTS OFF!", 3000, 1);
            }
        }
    }
    return 1;
}
Okay, basically

Nothing happens if I do for eg: /v lights

Any idea why
Reply


Messages In This Thread
strcmp problem - by MattSlater - 26.12.2012, 16:14
Re: strcmp problem - by Faisal_khan - 26.12.2012, 16:19
Re: strcmp problem - by MattSlater - 26.12.2012, 16:59
Re: strcmp problem - by Faisal_khan - 26.12.2012, 17:09
Re: strcmp problem - by MattSlater - 26.12.2012, 17:12
Re: strcmp problem - by Faisal_khan - 26.12.2012, 17:15
Re: strcmp problem - by MattSlater - 26.12.2012, 17:23
Re: strcmp problem - by RedCrossER - 26.12.2012, 19:26
Re: strcmp problem - by tyler12 - 26.12.2012, 19:28
Re: strcmp problem - by RedCrossER - 26.12.2012, 19:33

Forum Jump:


Users browsing this thread: 1 Guest(s)