SA-MP Forums Archive
help with command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: help with command (/showthread.php?tid=362433)



help with command - jaksimaksi - 24.07.2012

pawn Код:
CMD:lock(playerid, params[])
{
    new vehicleid,string[128],vardas[MAX_PLAYER_NAME];
    GetPlayerName(playerid,vardas,sizeof(vardas));
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        vehicleid = GetPlayerVehicleID(playerid);
    }
    else
    {
        vehicleid = GetClosestVehicle(playerid);
        if(!PlayerToVehicle(playerid, vehicleid, 5.0)) vehicleid = 0;
    }
    if(!vehicleid) return SendClientMessage(playerid, COLOR_RED, "You are not close to a vehicle!");
    new id = GetVehicleID(vehicleid);
    if(!IsValidVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "You don't have the keys for this vehicle!");
    if(!GetPlayerVehicleAccess(playerid, id))
        return SendClientMessage(playerid, COLOR_RED, "You don't have the keys for this vehicle!");
    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(doors == 1)
    {
        doors = 0;
        GameTextForPlayer(playerid, "~g~doors unlocked", 3000, 6);
     //    format(string, sizeof(string), "* %s paspaudћia mygtuką ir atrakina %s duris",vardas, VehicleNames[VehicleModel[playerid]-400]);
    //  SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
    }
    else
    {
        format(string, sizeof(string), "* %s paspaudћia mygtuką ir uћrakina %s duris",vardas, VehicleNames[VehicleModel[playerid]-400]);
        SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
        doors = 1;
        GameTextForPlayer(playerid, "~r~doors locked", 3000, 6);
      //  format(string, sizeof(string), "* %s paspaudћia mygtuką ir uћrakina %s duris",vardas, VehicleNames[VehicleModel[playerid]-400]);
        //SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
    }
    SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    return 1;
}

when i add thse lines

pawn Код:
format(string, sizeof(string), "* %s unlocks  %s doors",vardas, VehicleNames[VehicleModel[playerid]-400]);
        SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
   
format(string, sizeof(string), "* %s locks doors %s duris",vardas, VehicleNames[VehicleModel[playerid]-400]);
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
command doesnt works well, script says that car is unlocked and SERVER UNKNOWN COMMAND and car not unlocking, doesnt locks either. without these lines command works well


Re: help with command - jaksimaksi - 24.07.2012

help